actions_parser_fuzzer: Cap input size
Change the content_input_actions_parser_fuzzer to ignore huge inputs, in order to avoid spurious timeout and OOM clusterfuzz reports. The exact constant is chosen semi-arbitrarily: we set it at 100 KB; for reference, the OOM report happened on a 686 KB input. Fixed: 1497681 Change-Id: Ic501be24c60a8a27f2b4d0317fe73913f80c673f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5057760 Reviewed-by: Dave Tapuska <dtapuska@chromium.org> Auto-Submit: Maksim Ivanov <emaxx@chromium.org> Commit-Queue: Maksim Ivanov <emaxx@chromium.org> Cr-Commit-Position: refs/heads/main@{#1228816}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e41101fc96
commit
b76e62b849
@@ -14,6 +14,12 @@
|
|||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
|
constexpr size_t kMaxInputSize = 100 * 1000;
|
||||||
|
if (size > kMaxInputSize) {
|
||||||
|
// To avoid spurious timeout and out-of-memory fuzz reports.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
absl::optional<base::Value> value = base::JSONReader::Read(
|
absl::optional<base::Value> value = base::JSONReader::Read(
|
||||||
base::StringPiece(reinterpret_cast<const char*>(data), size));
|
base::StringPiece(reinterpret_cast<const char*>(data), size));
|
||||||
if (!value)
|
if (!value)
|
||||||
|
Reference in New Issue
Block a user