Hi Mitch,
Thank you for the response.
1. You don't need to build the library with `-fsanitize-coverage=...`, using `-fsanitize=fuzzer-no-link,address` should be sufficient. - Acknowledged
2. (although you can actually build object files/shared libraries with -fsanitize=fuzzer, and the libFuzzer main won't be linked, if this makes your build process easier). - with just the fuzzer flag, it looks for the LLVMFuzzerTestOneInput.
3. I've run a quick grep and can't find anything that would match "apifunc() resp=0x7ff38f83ac20 uninitialized, fixing it." in libFuzzer (or compiler-rt). What version of compiler-rt/llvm/clang are you trying this with? - This was an oversight on my part, it was a log dump from the library and somehow I mistook it be from libfuzzer. (I am using Clang 9 btw).
4. Have you tried
visualising the coverage that the fuzz target is generating? It may give you an insight as to why your desired function under test isn't being hit. - Yes, I am using lcov for coverage and do see the relevant methods being exercised.
I am wondering if there is a reason I am not seeing the function in the NEW_FUNC[x/xxx]: log lines.
To iterate my steps -
First I build the library with fuzzer-no-link,address flags. I don't compile the fuzz_target (the file containing the LLVMFuzzerTestOneInput function) with the library.
Then I build the fuzz target and link it with the library.
clang++ -g -O1 -fsanitize=fuzzer,address -Iinclude -Ibuild/include ..... fuzztarget.c -Lbuild/lib -llib1 -llib2
and then finally ./a.out -detect_leaks=0 corpus/
I appreciate your help with this.