[PATCH] D51692: [libfuzzer] Replace memmem with strstr.
Matt Morehouse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 5 14:04:51 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL341495: [libfuzzer] Replace memmem with strstr. (authored by morehouse, committed by ).
Herald added subscribers: llvm-commits, delcypher.
Changed prior to commit:
https://reviews.llvm.org/D51692?vs=164106&id=164107#toc
Repository:
rL LLVM
https://reviews.llvm.org/D51692
Files:
compiler-rt/trunk/test/fuzzer/InitializeTest.cpp
compiler-rt/trunk/test/fuzzer/initialize.test
Index: compiler-rt/trunk/test/fuzzer/InitializeTest.cpp
===================================================================
--- compiler-rt/trunk/test/fuzzer/InitializeTest.cpp
+++ compiler-rt/trunk/test/fuzzer/InitializeTest.cpp
@@ -9,7 +9,7 @@
#include <stdlib.h>
#include <string.h>
-static char *argv0;
+static char *argv0 = NULL;
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
assert(*argc > 0);
@@ -20,8 +20,7 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
assert(argv0);
- if (Size == strlen(argv0) &&
- !memmem(Data, Size, argv0, Size)) {
+ if (argv0 && Size >= 4 && !memcmp(Data, "fuzz", 4)) {
fprintf(stderr, "BINGO %s\n", argv0);
exit(1);
}
Index: compiler-rt/trunk/test/fuzzer/initialize.test
===================================================================
--- compiler-rt/trunk/test/fuzzer/initialize.test
+++ compiler-rt/trunk/test/fuzzer/initialize.test
@@ -1,4 +1,4 @@
-# FIXME: Disabled on Windows because memmem is a GNU extension.
+# FIXME: Disabled on Windows since LLVMFuzzerInitialize does not yet work.
UNSUPPORTED: windows
CHECK: BINGO
RUN: %cpp_compiler %S/InitializeTest.cpp -o %t-InitializeTest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51692.164107.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180905/8fbc3e39/attachment.bin>
More information about the llvm-commits
mailing list