diff options
author | Jeffrey Kardatzke <jkardatzke@google.com> | 2019-10-18 11:46:39 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-10-22 13:29:04 -0700 |
commit | 56bdf2c0dff03c6fa28907b2f17dc09e4b77a955 (patch) | |
tree | 1e892ea4b32fdc053c54eba795a0f7c6fefc3ead | |
parent | 79d2f4b650f7ce1c890ea2c190dd2d0ee82f5987 (diff) | |
download | platform_external_libbrillo-56bdf2c0dff03c6fa28907b2f17dc09e4b77a955.tar.gz platform_external_libbrillo-56bdf2c0dff03c6fa28907b2f17dc09e4b77a955.tar.bz2 platform_external_libbrillo-56bdf2c0dff03c6fa28907b2f17dc09e4b77a955.zip |
libbrillo: Fix timeout for libbrillo_http_form_data_fuzzer
This was timing out when it was consuming the stream it had generated
through fuzzing. Reading that stream is now more optimized to avoid
hitting the timeout.
BUG=chromium:1014980
TEST=Fuzzer no longer times out on test case
Change-Id: Ie658a428f42f59d92ea803fd84e087cb87207466
Reviewed-on: https://chromium-review.googlesource.com/1869261
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Ready: Jeffrey Kardatzke <jkardatzke@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Cr-Mirrored-From: https://chromium.googlesource.com/chromiumos/platform2
Cr-Mirrored-Commit: 0fc62ad016075a449bcf16c7d0d4f99d449ec747
-rw-r--r-- | brillo/http/http_form_data_fuzzer.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/brillo/http/http_form_data_fuzzer.cc b/brillo/http/http_form_data_fuzzer.cc index e252b47..f5ae4b7 100644 --- a/brillo/http/http_form_data_fuzzer.cc +++ b/brillo/http/http_form_data_fuzzer.cc @@ -108,11 +108,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (!form_stream) return 0; - uint8_t buffer[512]; - size_t size_read; + // We need to use a decent sized buffer and call ReadAllBlocking to avoid + // excess overhead with reading here that can make the fuzzer timeout. + uint8_t buffer[32768]; while (form_stream->GetRemainingSize() > 0) { - if (!form_stream->ReadBlocking(buffer, sizeof(buffer), &size_read, - nullptr)) { + if (!form_stream->ReadAllBlocking(buffer, sizeof(buffer), nullptr)) { // If there's an error reading from the stream, then bail since we'd // likely just see repeated errors and never exit. break; |