Exercise 2 — libFuzzer + sanitizers
Placeholder content — fill in with the real lab steps.
Goals
- Write a
LLVMFuzzerTestOneInputharness for an in-process target. - Build with
-fsanitize=fuzzer,address,undefinedto enable libFuzzer- ASan + UBSan.
- Distinguish heap-buffer-overflow vs. integer-overflow vs. use-after-free findings in the sanitizer output.
- Reduce a crashing input with
-minimize_crash=1.
Steps
- Open
harness.ccin the lab directory. - Implement the harness against the target API.
- Compile:
clang++ -g -O1 -fsanitize=fuzzer,address,undefined harness.cc target.cc -o harness. - Run:
./harness -max_total_time=120 corpus/. - Read the sanitizer report on the first crash; classify the bug.
- Minimize the crashing input:
./harness -minimize_crash=1 crash-<hash>.