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

Side by Side Diff: net/url_request/url_request_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, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/url_request/url_request.h"
6
7 #include <stddef.h>
8 #include <stdint.h>
9
10 #include <memory>
11
12 #include "base/run_loop.h"
13 #include "net/base/fuzzed_data_provider.h"
14 #include "net/base/request_priority.h"
15 #include "net/socket/fuzzed_socket_factory.h"
16 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_context.h"
18 #include "net/url_request/url_request_test_util.h"
19 #include "url/gurl.h"
20
21 // Integration fuzzer for URLRequest's handling of HTTP requests. Can follow
22 // redirects, both on the same server (using a new socket or the old one) and
23 // across servers.
24 // TODO(mmenke): Add support for testing HTTPS, FTP, auth, proxies, uploading,
25 // cancelation, deferring reads / redirects, using preconnected sockets, SPDY,
26 // QUIC, DNS failures (they all currently resolve to localhost), IPv6 DNS
27 // results, URLs with IPs instead of hostnames (v4 and v6), etc.
28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
29 net::FuzzedDataProvider data_provider(data, size);
30 net::TestURLRequestContext url_request_context(true);
31 net::FuzzedSocketFactory fuzzed_socket_factory(&data_provider);
32 url_request_context.set_client_socket_factory(&fuzzed_socket_factory);
33 url_request_context.Init();
34
35 net::TestDelegate delegate;
36
37 std::unique_ptr<net::URLRequest> url_request(
38 url_request_context.CreateRequest(GURL("http://foo/"),
39 net::DEFAULT_PRIORITY, &delegate));
40 url_request->Start();
41 // TestDelegate quits the message loop on completion.
42 base::RunLoop().Run();
43 return 0;
44 }
OLDNEW
« net/base/fuzzed_data_provider.h ('K') | « net/socket/socks_client_socket_fuzzer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698