Skip to content

Commit d17f944

Browse files
committed
refactor: address CodeRabbit review feedback
- Use null-delimited find loop in build.sh to safely handle filenames with spaces (SC2044) - Expand contract_params_fuzzer to cover address[] and bytes32[] array encoders (extends coverage from 8 to 10 encoding paths) - Remove redundant paths filter from workflow trigger (paths: ["**"] is equivalent to omitting it)
1 parent 7ce0849 commit d17f944

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

.clusterfuzzlite/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pip3 install .
1515
pip3 install atheris pyinstaller
1616

1717
# Build every *_fuzzer.py target found in the .clusterfuzzlite directory.
18-
for fuzzer in $(find "$SRC/hiero-sdk-python/.clusterfuzzlite" -name '*_fuzzer.py'); do
18+
find "$SRC/hiero-sdk-python/.clusterfuzzlite" -name '*_fuzzer.py' -print0 | while IFS= read -r -d '' fuzzer; do
1919
fuzzer_basename=$(basename -s .py "$fuzzer")
2020
fuzzer_package="${fuzzer_basename}.pkg"
2121

.clusterfuzzlite/contract_params_fuzzer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def TestOneInput(data: bytes) -> None:
1515
"""Feed arbitrary bytes into ContractFunctionParameters encoding paths."""
1616
fdp = atheris.FuzzedDataProvider(data)
17-
choice = fdp.ConsumeIntInRange(0, 7)
17+
choice = fdp.ConsumeIntInRange(0, 9)
1818

1919
try:
2020
params = ContractFunctionParameters()
@@ -36,9 +36,15 @@ def TestOneInput(data: bytes) -> None:
3636
elif choice == 6:
3737
count = fdp.ConsumeIntInRange(0, 8)
3838
params.add_string_array([fdp.ConsumeUnicodeNoSurrogates(64) for _ in range(count)])
39-
else:
39+
elif choice == 7:
4040
count = fdp.ConsumeIntInRange(0, 8)
4141
params.add_bytes_array([fdp.ConsumeBytes(32) for _ in range(count)])
42+
elif choice == 8:
43+
count = fdp.ConsumeIntInRange(0, 8)
44+
params.add_address_array([fdp.ConsumeBytes(20).hex() for _ in range(count)])
45+
else:
46+
count = fdp.ConsumeIntInRange(0, 8)
47+
params.add_bytes32_array([fdp.ConsumeBytes(32) for _ in range(count)])
4248

4349
params.to_bytes()
4450

.github/workflows/clusterfuzzlite.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: ClusterFuzzLite
22

33
on:
44
pull_request:
5-
paths:
6-
- "**"
75
push:
86
branches:
97
- main

0 commit comments

Comments
 (0)