[libc-commits] [PATCH] D74091: [libc] Lay out framework for fuzzing libc functions.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Feb 5 15:20:36 PST 2020


sivachandra added inline comments.


================
Comment at: libc/fuzzing/string/strcpy_fuzz.cpp:7
+
+extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
+  if (size == 0) {
----------------
abrachet wrote:
> Does `oss-fuzz` require this to not be mangled?
Just a few high level comments for now. Might have more later.

Avoid using malloc/memcpy/abort:
- Return a non-zero value instead of abort.
- Instead of malloc/memcpy/free, split the input data into two parts deterministic-ally. Say, use the first N bytes to determine the size of the first part.
- If you think a generic data provider makes sense, then we should probably build one for our use. For example, like this: https://github.com/llvm/llvm-project/blob/master/compiler-rt/include/fuzzer/FuzzedDataProvider.h




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74091/new/

https://reviews.llvm.org/D74091





More information about the libc-commits mailing list