[PATCH] D20943: [LibFuzzer] Declare and use sanitizer functions in `fuzzer::ExternalFunctions`
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 15:20:17 PDT 2016
kcc added inline comments.
================
Comment at: lib/Fuzzer/FuzzerExtFunctions.h:21
@@ +20,3 @@
+ // Initialize function pointers. Functions that are not available will be set
+ // to nullptr. Do not call this constructor before ``main()`` has been
+ // entered.
----------------
That's quite strange, but ok...
================
Comment at: lib/Fuzzer/test/FuzzerUnittest.cpp:430
@@ +429,3 @@
+ // Make sure we free to avoid LSan firing.
+ std::unique_ptr<ExternalFunctions> t(new ExternalFunctions());
+ fuzzer::EF = t.get();
----------------
Of course, if you do
EF = new ...
...
EF = nullptr
lsan will bark.
Ideally, I want to not add main()
Can you create and destroy EF in every test that needs it?
std::unique_ptr<ExternalFunctions> t(new ExternalFunctions());
EF = t.get();
...
http://reviews.llvm.org/D20943
More information about the llvm-commits
mailing list