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

Unified Diff: net/url_request/url_request_data_job_fuzzer.cc

Issue 2191323005: A couple fixes to net_data_job_fuzzer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove DCHECK Created 4 years, 5 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/url_request/url_request_data_job_fuzzer.cc
diff --git a/net/url_request/url_request_data_job_fuzzer.cc b/net/url_request/url_request_data_job_fuzzer.cc
index a770195a21fb409a793fde7c5866e1039fba70c2..4378c8596ea0fcf6a09b2097f27fed7a7a982cc5 100644
--- a/net/url_request/url_request_data_job_fuzzer.cc
+++ b/net/url_request/url_request_data_job_fuzzer.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <memory>
+#include <string>
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
@@ -63,10 +64,12 @@ class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
simulated_bytes_read += read_length;
}
- // The data URL is the rest of the fuzzed data. If the URL is invalid just
+ // The data URL is the rest of the fuzzed data with "data:" prepended, to
+ // ensure that if it's a URL, it's a data URL. If the URL is invalid just
// use a test variant, so the fuzzer has a chance to execute something.
- base::StringPiece data_bytes(provider.ConsumeRemainingBytes());
- GURL data_url(data_bytes);
+ std::string data_url_string =
+ std::string("data:") + provider.ConsumeRemainingBytes().as_string();
+ GURL data_url(data_url_string);
if (!data_url.is_valid())
data_url = GURL("data:text/html;charset=utf-8,<p>test</p>");
@@ -109,8 +112,6 @@ class URLRequestDataJobFuzzerHarness : public net::URLRequest::Delegate {
int bytes_read = 0;
sync = request->Read(buf_.get(), read_size, &bytes_read);
- // No more populated reads implies !bytes_read.
- DCHECK(using_populated_read || !bytes_read);
} while (sync);
if (!request->status().is_io_pending())
« 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