[libc-commits] [PATCH] D82247: [libc] Add fuzz test for strcmp.

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jun 22 19:52:54 PDT 2020


PaulkaToast accepted this revision.
PaulkaToast added a comment.
This revision is now accepted and ready to land.

After comments are addressed LGTM but you might want to wait for approval from sivachandra.



================
Comment at: libc/fuzzing/string/strcmp_fuzz.cpp:28
+
+  const size_t minimum_size = std::min(size1, size2);
+
----------------
I think its beneficial to avoid dependency on C++ headers for the fuzzing tests, since std::min is only used here maybe just replace this with an if condition? It could in theory produce a circular dependency because libc++ could depend on some libc functions which is what we are trying to fuzz here.


================
Comment at: libc/fuzzing/string/strcmp_fuzz.cpp:36
+  for (i = 0; i < minimum_size && s1[i] && s1[i] == s2[i]; ++i)
+    ;
+
----------------
nit: using `continue;` would make this more explicit but its totally up to you. (:


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82247





More information about the libc-commits mailing list