From 54d0d153fa93d19b363a018025b89970977bfc02 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Wed, 6 Mar 2019 11:34:55 +0100 Subject: [PATCH] Reduce input file size for solc and constant optimizer fuzzers. --- test/tools/ossfuzz/const_opt_ossfuzz.cpp | 7 +++++-- test/tools/ossfuzz/solc_noopt_ossfuzz.cpp | 7 +++++-- test/tools/ossfuzz/solc_opt_ossfuzz.cpp | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/test/tools/ossfuzz/const_opt_ossfuzz.cpp b/test/tools/ossfuzz/const_opt_ossfuzz.cpp index fc77332e6..13ceb8408 100644 --- a/test/tools/ossfuzz/const_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/const_opt_ossfuzz.cpp @@ -21,7 +21,10 @@ using namespace std; extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) { - string input(reinterpret_cast(_data), _size); - FuzzerUtil::testConstantOptimizer(input, /*quiet=*/true); + if (_size <= 250) + { + string input(reinterpret_cast(_data), _size); + FuzzerUtil::testConstantOptimizer(input, /*quiet=*/true); + } return 0; } \ No newline at end of file diff --git a/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp b/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp index 7e28c3aca..3a2ac5f27 100644 --- a/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_noopt_ossfuzz.cpp @@ -21,7 +21,10 @@ using namespace std; extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) { - string input(reinterpret_cast(_data), _size); - FuzzerUtil::testCompiler(input, /*optimize=*/false, /*quiet=*/true); + if (_size <= 600) + { + string input(reinterpret_cast(_data), _size); + FuzzerUtil::testCompiler(input, /*optimize=*/false, /*quiet=*/true); + } return 0; } diff --git a/test/tools/ossfuzz/solc_opt_ossfuzz.cpp b/test/tools/ossfuzz/solc_opt_ossfuzz.cpp index 3ad8e5f74..72a59cba4 100644 --- a/test/tools/ossfuzz/solc_opt_ossfuzz.cpp +++ b/test/tools/ossfuzz/solc_opt_ossfuzz.cpp @@ -21,7 +21,10 @@ using namespace std; extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size) { - string input(reinterpret_cast(_data), _size); - FuzzerUtil::testCompiler(input, /*optimize=*/true, /*quiet=*/true); + if (_size <= 600) + { + string input(reinterpret_cast(_data), _size); + FuzzerUtil::testCompiler(input, /*optimize=*/true, /*quiet=*/true); + } return 0; }