Skip to content

Commit

Permalink
Fix binary-only mode for Honggfuzz
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheitman committed Jun 28, 2023
1 parent a6f9757 commit f6ca23a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions engines/pastis-honggfuzz/pastishf/honggfuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def start(self, target: str, target_arguments: str, workspace: Workspace, exmode
# Build target command line.
target_cmdline = f"{target} {target_arguments}"

HFQBDIPRELOAD_LIB_PATH = os.getenv('HFQBDIPRELOAD_LIB_PATH')
HFQBDI_LIB_PATH = os.getenv('HFQBDI_LIB_PATH')

if fuzzmode == FuzzMode.BINARY_ONLY and HFQBDIPRELOAD_LIB_PATH is None:
logging.error(f"target in BINARY_ONLY but can't find HFQBDIPRELOAD_LIB_PATH")
if fuzzmode == FuzzMode.BINARY_ONLY and HFQBDI_LIB_PATH is None:
logging.error(f"target in BINARY_ONLY but can't find HFQBDI_LIB_PATH")
return False

# Build fuzzer arguments.
Expand All @@ -61,7 +61,9 @@ def start(self, target: str, target_arguments: str, workspace: Workspace, exmode
f"--stdin_input" if stdin else "",
f"--persistent" if exmode == ExecMode.PERSISTENT or fuzzmode == FuzzMode.BINARY_ONLY else "",
f"--env HFQBDI_FS=1" if fuzzmode == FuzzMode.BINARY_ONLY else "",
f"--env LD_PRELOAD={HFQBDIPRELOAD_LIB_PATH}/libHFQBDIpreload.so" if fuzzmode == FuzzMode.BINARY_ONLY else "",
f"--env LD_LIBRARY_PATH={HFQBDI_LIB_PATH}" if fuzzmode == FuzzMode.BINARY_ONLY else "",
f"--env LD_PRELOAD={HFQBDI_LIB_PATH}/libHFQBDIpreload.so" if fuzzmode == FuzzMode.BINARY_ONLY else "",
f"--env LD_BIND_NOW=1" if fuzzmode == FuzzMode.BINARY_ONLY else "",
re.sub(r"\s", " ", engine_args), # Any arguments coming right from the broker (remove \r\n)
f"--logfile logfile.log",
f"--input {workspace.input_dir}",
Expand Down

0 comments on commit f6ca23a

Please sign in to comment.