From 11b439be08e713284f09eba5547142b6ea2924f3 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 21 Nov 2016 16:58:22 +0900 Subject: Imported Upstream version 20160601 Change-Id: I89d6c9dac409aeeb940c58029f34a1292d4cb0a1 Signed-off-by: DongHun Kwak --- util/fuzz.cc | 21 +++++++++++++++++++++ util/test.cc | 2 +- util/util.h | 16 +--------------- 3 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 util/fuzz.cc (limited to 'util') diff --git a/util/fuzz.cc b/util/fuzz.cc new file mode 100644 index 0000000..9cac118 --- /dev/null +++ b/util/fuzz.cc @@ -0,0 +1,21 @@ +// Copyright 2016 The RE2 Authors. All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include +#include +#include + +// Entry point for libFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); + +int main(int argc, char** argv) { + uint8_t data[32]; + for (int i = 0; i < 32; i++) { + for (int j = 0; j < 32; j++) { + data[j] = random() & 0xFF; + } + LLVMFuzzerTestOneInput(data, 32); + } + return 0; +} diff --git a/util/test.cc b/util/test.cc index b0167e7..0a751fe 100644 --- a/util/test.cc +++ b/util/test.cc @@ -23,7 +23,7 @@ void RegisterTest(void (*fn)(void), const char *name) { tests[ntests++].name = name; } -int main(int argc, char **argv) { +int main(int argc, char** argv) { for (int i = 0; i < ntests; i++) { printf("%s\n", tests[i].name); tests[i].fn(); diff --git a/util/util.h b/util/util.h index 7dfab93..1e78aa3 100644 --- a/util/util.h +++ b/util/util.h @@ -32,6 +32,7 @@ #include #include #include // For std::call_once +#include // Use std names. using std::set; @@ -46,22 +47,7 @@ using std::stack; using std::sort; using std::swap; using std::make_pair; - -#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION) - -#include -using std::tr1::unordered_set; - -#else - -#include -#if defined(_WIN32) -using std::tr1::unordered_set; -#else using std::unordered_set; -#endif - -#endif #ifdef _WIN32 -- cgit v1.2.3