Chromium Code Reviews| OLD | NEW |
|---|---|
| (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. | |
| 22 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | |
| 23 net::FuzzedDataProvider data_provider(data, size); | |
| 24 net::TestURLRequestContext url_request_context(true); | |
| 25 net::FuzzedSocketFactory fuzzed_socket_factory(&data_provider); | |
| 26 url_request_context.set_client_socket_factory(&fuzzed_socket_factory); | |
| 27 url_request_context.Init(); | |
| 28 | |
| 29 net::TestDelegate delegate; | |
| 30 | |
| 31 std::unique_ptr<net::URLRequest> url_request( | |
| 32 url_request_context.CreateRequest(GURL("http://foo/"), | |
|
eroman
2016/04/22 22:07:11
neato!
Some suggestions for the future:
* Fuzz
mmenke
2016/04/25 15:09:19
Yea, I agree with all of these.
| |
| 33 net::DEFAULT_PRIORITY, &delegate)); | |
| 34 url_request->Start(); | |
| 35 base::RunLoop().RunUntilIdle(); | |
| 36 return 0; | |
| 37 } | |
| OLD | NEW |