From 315a2fd03c94c93d4a7089d23d734e4aaccbe066 Mon Sep 17 00:00:00 2001 From: David Lakin Date: Wed, 15 May 2024 13:36:29 -0400 Subject: [PATCH] Instrument test utility functions to increase fuzzer efficiency Fuzz Introspector was reporting a high percentage of fuzz blockers in the `fuzz_diff` test. This means the fuzzing engine was unable to gain visibility into functions lower in the call stack than the blocking functions, making it less effective at producing interesting input data. This clears a large percentage of the fuzz blockers by adding fuzzer instrumentation to them via the `@atheris.instrument_func` decorator. --- fuzzing/fuzz-targets/fuzz_diff.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fuzzing/fuzz-targets/fuzz_diff.py b/fuzzing/fuzz-targets/fuzz_diff.py index ba44995f2..d4bd68b57 100644 --- a/fuzzing/fuzz-targets/fuzz_diff.py +++ b/fuzzing/fuzz-targets/fuzz_diff.py @@ -17,16 +17,19 @@ class BytesProcessAdapter: """Allows bytes to be used as process objects returned by subprocess.Popen.""" + @atheris.instrument_func def __init__(self, input_string): self.stdout = io.BytesIO(input_string) self.stderr = io.BytesIO() + @atheris.instrument_func def wait(self): return 0 poll = wait +@atheris.instrument_func def TestOneInput(data): fdp = atheris.FuzzedDataProvider(data)