[PATCH] D29751: [libFuzzer] Use dynamic loading for External Functions on Windows.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 17:05:05 PST 2017


zturner added inline comments.


================
Comment at: lib/Fuzzer/FuzzerExtFunctionsDlsymWin.cpp:45
+         Fn = GetProcAddress(Modules[i], #NAME "__dll");                       \
+      this->NAME = (decltype(ExternalFunctions::NAME)) Fn;                     \
+    }
----------------
Should this be:

```
this->NAME = (decltype(ExternalFunctions::NAME)*) Fn;
```

?  It looks like you're casting to a function instead of a function pointer.  (Not sure if there's a difference)


================
Comment at: lib/Fuzzer/FuzzerExtFunctionsDlsymWin.cpp:46
+      this->NAME = (decltype(ExternalFunctions::NAME)) Fn;                     \
+    }
+#include "FuzzerExtFunctions.def"
----------------
What if it still can't find it?  You don't set `this->NAME` to anything, so it's uninitialized memory, but you don't indicate any kind of error.

Also, what happens if it could be found in more than one module but we choose the wrong one?  


https://reviews.llvm.org/D29751





More information about the llvm-commits mailing list