[llvm] r281066 - [libFuzzer] one more puzzle, value_profile cracks it in a second

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 11:00:04 PDT 2016


Author: kcc
Date: Fri Sep  9 13:00:04 2016
New Revision: 281066

URL: http://llvm.org/viewvc/llvm-project?rev=281066&view=rev
Log:
[libFuzzer] one more puzzle, value_profile cracks it in a second

Added:
    llvm/trunk/lib/Fuzzer/test/AbsNegAndConstantTest.cpp
Modified:
    llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
    llvm/trunk/lib/Fuzzer/test/value-profile-cmp.test

Added: llvm/trunk/lib/Fuzzer/test/AbsNegAndConstantTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/AbsNegAndConstantTest.cpp?rev=281066&view=auto
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/AbsNegAndConstantTest.cpp (added)
+++ llvm/trunk/lib/Fuzzer/test/AbsNegAndConstantTest.cpp Fri Sep  9 13:00:04 2016
@@ -0,0 +1,23 @@
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+
+// abs(x) < 0 and y == Const puzzle.
+#include <cstring>
+#include <cstdint>
+#include <cstdlib>
+#include <cstddef>
+#include <cstdio>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+  if (Size < 8) return 0;
+  int x;
+  unsigned y;
+  memcpy(&x, Data, 4);
+  memcpy(&y, Data + 4, 4);
+  if (abs(x) < 0 && y == 0xbaddcafe) {
+    printf("BINGO; Found the target, exiting; x = 0x%x y 0x%x\n", x, y);
+    exit(1);
+  }
+  return 0;
+}
+

Modified: llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/CMakeLists.txt?rev=281066&r1=281065&r2=281066&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/test/CMakeLists.txt Fri Sep  9 13:00:04 2016
@@ -62,6 +62,7 @@ set(TestBinaries)
 ###############################################################################
 
 set(Tests
+  AbsNegAndConstantTest
   AccumulateAllocationsTest
   BufferOverflowOnInput
   CallerCalleeTest

Modified: llvm/trunk/lib/Fuzzer/test/value-profile-cmp.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/value-profile-cmp.test?rev=281066&r1=281065&r2=281066&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/value-profile-cmp.test (original)
+++ llvm/trunk/lib/Fuzzer/test/value-profile-cmp.test Fri Sep  9 13:00:04 2016
@@ -1,5 +1,6 @@
 CHECK: BINGO
 RUN: not LLVMFuzzer-SimpleCmpTest -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s
 RUN: not LLVMFuzzer-SimpleHashTest -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s
+RUN: not LLVMFuzzer-AbsNegAndConstantTest -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s
 
 




More information about the llvm-commits mailing list