[llvm] r299177 - [libFuzzer] ensure that strncmp is not inlined in a test

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 20:34:34 PDT 2017


Author: kcc
Date: Thu Mar 30 22:34:33 2017
New Revision: 299177

URL: http://llvm.org/viewvc/llvm-project?rev=299177&view=rev
Log:
[libFuzzer] ensure that strncmp is not inlined in a test

Modified:
    llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp

Modified: llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp?rev=299177&r1=299176&r2=299177&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp (original)
+++ llvm/trunk/lib/Fuzzer/test/SingleStrncmpTest.cpp Thu Mar 30 22:34:33 2017
@@ -9,7 +9,8 @@
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   char *S = (char*)Data;
-  if (Size >= 6 && !strncmp(S, "qwerty", 6)) {
+  volatile auto Strncmp = &(strncmp);   // Make sure strncmp is not inlined.
+  if (Size >= 6 && !Strncmp(S, "qwerty", 6)) {
     fprintf(stderr, "BINGO\n");
     exit(1);
   }




More information about the llvm-commits mailing list