Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: net/http/http_stream_parser_fuzzer.cc

Issue 1920463003: Fix HttpStreamParser fuzzer (again) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_parser_fuzzer.cc
diff --git a/net/http/http_stream_parser_fuzzer.cc b/net/http/http_stream_parser_fuzzer.cc
index 52343ac30b93dbec73f69e161c50f9cd68266a53..c58fa9f8554b815afce7466f0c1832efbd745a02 100644
--- a/net/http/http_stream_parser_fuzzer.cc
+++ b/net/http/http_stream_parser_fuzzer.cc
@@ -65,7 +65,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
result = parser.ReadResponseHeaders(callback.callback());
result = callback.GetResult(result);
- while (result > 0) {
+ if (result < 0)
+ return 0;
+
+ while (true) {
scoped_refptr<net::IOBufferWithSize> io_buffer(
new net::IOBufferWithSize(64));
result = parser.ReadResponseBody(io_buffer.get(), io_buffer->size(),
@@ -74,8 +77,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Releasing the pointer to IOBuffer immediately is more likely to lead to a
// use-after-free.
io_buffer = nullptr;
-
- result = callback.GetResult(result);
+ if (callback.GetResult(result) <= 0)
+ break;
}
return 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698