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

Unified Diff: net/http/http_proxy_client_socket_fuzzer.cc

Issue 1917503002: URLRequest fuzzer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fuzz
Patch Set: Add missing include 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
Index: net/http/http_proxy_client_socket_fuzzer.cc
diff --git a/net/http/http_proxy_client_socket_fuzzer.cc b/net/http/http_proxy_client_socket_fuzzer.cc
index 2fab8e03d4363196ef3dd4fc04acfaec5ebb8ccc..8c4b80e8ec39d51dd53efec8e3e56dacc2bd435b 100644
--- a/net/http/http_proxy_client_socket_fuzzer.cc
+++ b/net/http/http_proxy_client_socket_fuzzer.cc
@@ -14,6 +14,7 @@
#include "base/strings/utf_string_conversions.h"
#include "net/base/address_list.h"
#include "net/base/auth.h"
+#include "net/base/fuzzed_data_provider.h"
#include "net/base/host_port_pair.h"
#include "net/base/test_completion_callback.h"
#include "net/http/http_auth_cache.h"
@@ -33,19 +34,13 @@
// class for details.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Use a test NetLog, to exercise logging code.
- net::BoundTestNetLog bound_test_net_log;
+ net::TestNetLog test_net_log;
- // Use last byte to determine if the HttpProxyClientSocket should be told the
- // underlying socket is HTTPS.
- bool is_https_proxy = 0;
- if (size > 0) {
- is_https_proxy = !(data[size - 1] & 1);
- size--;
- }
+ net::FuzzedDataProvider data_provider(data, size);
net::TestCompletionCallback callback;
std::unique_ptr<net::FuzzedSocket> fuzzed_socket(
- new net::FuzzedSocket(data, size, bound_test_net_log.bound()));
+ new net::FuzzedSocket(&data_provider, &test_net_log));
CHECK_EQ(net::OK, fuzzed_socket->Connect(callback.callback()));
std::unique_ptr<net::ClientSocketHandle> socket_handle(
@@ -65,6 +60,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
new net::HttpAuthController(net::HttpAuth::AUTH_PROXY,
GURL("http://proxy:42/"), &auth_cache,
&auth_handler_factory));
+ // Determine if the HttpProxyClientSocket should be told the underlying socket
+ // is HTTPS.
+ bool is_https_proxy = data_provider.ConsumeBool();
net::HttpProxyClientSocket socket(
socket_handle.release(), "Bond/007", net::HostPortPair("foo", 80),
net::HostPortPair("proxy", 42), auth_controller.get(), true /* tunnel */,

Powered by Google App Engine
This is Rietveld 408576698