Skip to content

Commit e527188

Browse files
committed
Properly handle indentation and process data after the file is closed.
1 parent 4bc7c94 commit e527188

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

fuzz/collect_fuzz_python.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -256,25 +256,25 @@ def substitute_one_repo(
256256
valid_inputs = []
257257
with open(input_path, "rb") as f_input:
258258
lines = f_input.readlines()
259-
# File is closed, now process data
260-
for line in lines:
261-
# Use errors='replace' to ensure decoding doesn't fail
262-
decoded = line.decode("utf-8", errors="replace")
263-
264-
# Only process lines starting with b' or b"
265-
if decoded.startswith(("b'", 'b"')):
266-
if decoded.startswith("b'") and decoded.endswith("'\n"):
267-
byte_data = line[2:-2]
268-
elif decoded.startswith('b"') and decoded.endswith('"\n'):
269-
byte_data = line[2:-2]
270-
else:
271-
continue
272-
273-
if 0 < len(byte_data) <= max_len:
274-
valid_inputs.append(byte_data)
275-
# For other lines, if length is within range and doesn't start with b' or b", also consider adding
276-
elif 0 < len(line) <= max_len:
277-
valid_inputs.append(line)
259+
# File is closed, now process data
260+
for line in lines:
261+
# Use errors='replace' to ensure decoding doesn't fail
262+
decoded = line.decode("utf-8", errors="replace")
263+
264+
# Only process lines starting with b' or b"
265+
if decoded.startswith(("b'", 'b"')):
266+
if decoded.startswith("b'") and decoded.endswith("'\n"):
267+
byte_data = line[2:-2]
268+
elif decoded.startswith('b"') and decoded.endswith('"\n'):
269+
byte_data = line[2:-2]
270+
else:
271+
continue
272+
273+
if 0 < len(byte_data) <= max_len:
274+
valid_inputs.append(byte_data)
275+
# For other lines, if length is within range and doesn't start with b' or b", also consider adding
276+
elif 0 < len(line) <= max_len:
277+
valid_inputs.append(line)
278278

279279
if not valid_inputs:
280280
# Use transformed_target instead of target_name

0 commit comments

Comments
 (0)