Skip to content

extract_functions: fix crash on absolute seed corpus links and the -E fallback - #5

Open
BiNeurale wants to merge 2 commits into
vul337:mainfrom
BiNeurale:fix-extract-functions
Open

BiNeurale wants to merge 2 commits into
vul337:mainfrom
BiNeurale:fix-extract-functions

Conversation

@BiNeurale

Copy link
Copy Markdown

Two small fixes in extract_functions.py that I needed to get the pipeline running on zlib (oss-fuzz pinned to 4bca88f3, your base-builder and base-runner images).

zlib's build.sh creates the per-fuzzer seed corpora as absolute links to /out/seed_corpus.zip, which dangle on the host, so is_elf() stopped the whole run with "FileNotFoundError: ... build/out/zlib/checksum_fuzzer_seed_corpus.zip". The first commit makes is_elf() skip anything that is not a regular file and maps a /out/... link back to build/out/, so the corpus is found and coverage runs. Before it, zlib gave 0 extracted functions; with it, 8 of the 10 fuzzers get coverage and 57 functions are extracted. gdk-pixbuf and poppler use the same kind of link at that oss-fuzz commit.

The second commit fixes the -E fallback in clang_and_extract(). compile_args drops the compiler, which is right for clang-extract, but the fallback runs the same list directly, so docker exec fails with 'exec: "-fPIC": executable file not found in $PATH' every time clang-extract fails. I forced the fallback on 10 zlib functions: 0 of 10 before, 10 of 10 after.

PR #4 already covers the problems in compile_ossfuzz.py; these two are separate and don't touch the same files.

zlib's build.sh links $OUT/<fuzzer>_seed_corpus.zip to /out/seed_corpus.zip,
which dangles on the host: is_elf() raised FileNotFoundError and aborted the
run, and the coverage step skipped every fuzzer with such a corpus.
compile_args drops argv[0] for clang-extract, but the -E fallback reused it,
so docker exec tried to run the first flag and failed with exit 127.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant