From 76e7a0ff55f8f3d622a2fdf4a0e91ba6213862a2 Mon Sep 17 00:00:00 2001 From: Vladimir Glavnyy <31897320+vglavnyy@users.noreply.github.com> Date: Sat, 30 Jan 2021 21:43:31 +0700 Subject: [PATCH] [fuzzer] Limit parser_fuzzer execution time (#6431) Limit the length of the fuzzer input to 16384 characters to prevent timeout in JSON parser (Vector of tables with key). Related oss-fuzz issues: - 5742497110294528 --- tests/fuzzer/flatbuffers_monster_fuzzer.cc | 2 +- tests/fuzzer/flatbuffers_parser_fuzzer.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/fuzzer/flatbuffers_monster_fuzzer.cc b/tests/fuzzer/flatbuffers_monster_fuzzer.cc index 5702189ac..1609c71e8 100644 --- a/tests/fuzzer/flatbuffers_monster_fuzzer.cc +++ b/tests/fuzzer/flatbuffers_monster_fuzzer.cc @@ -35,7 +35,7 @@ static fs::path exe_path_; namespace { static constexpr size_t kMinInputLength = 1; -static constexpr size_t kMaxInputLength = 99000; +static constexpr size_t kMaxInputLength = 16384; static constexpr uint8_t flags_strict_json = 0x80; static constexpr uint8_t flags_skip_unexpected_fields_in_json = 0x40; diff --git a/tests/fuzzer/flatbuffers_parser_fuzzer.cc b/tests/fuzzer/flatbuffers_parser_fuzzer.cc index d4bbb0e2f..0b74f2ceb 100644 --- a/tests/fuzzer/flatbuffers_parser_fuzzer.cc +++ b/tests/fuzzer/flatbuffers_parser_fuzzer.cc @@ -10,7 +10,7 @@ #include "test_init.h" static constexpr size_t kMinInputLength = 1; -static constexpr size_t kMaxInputLength = 33000; +static constexpr size_t kMaxInputLength = 16384; static constexpr uint8_t flags_strict_json = 0x80; static constexpr uint8_t flags_skip_unexpected_fields_in_json = 0x40;