[libc-commits] [PATCH] D144996: [libc] Add strcspn fuzz test

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Feb 28 15:28:47 PST 2023


michaelrj added inline comments.


================
Comment at: libc/fuzzing/string/strcspn_fuzz.cpp:23
+
+  size_t delim_size = (rand() % size);
+  char *reject_str = new char[delim_size + 1];
----------------
afaik it's best practice to use a segment of the data passed to the fuzzer if you need a random number, so that the test is more repeatable. For an example you can see how the base is selected in `strtointeger_fuzz.cpp`.


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

https://reviews.llvm.org/D144996



More information about the libc-commits mailing list