| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/test/fuzzed_data_provider.h" | 18 #include "base/test/fuzzed_data_provider.h" |
| 19 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/test_completion_callback.h" | 21 #include "net/base/test_completion_callback.h" |
| 22 #include "net/http/http_request_headers.h" | 22 #include "net/http/http_request_headers.h" |
| 23 #include "net/http/http_request_info.h" | 23 #include "net/http/http_request_info.h" |
| 24 #include "net/http/http_response_info.h" | 24 #include "net/http/http_response_info.h" |
| 25 #include "net/log/net_log.h" | |
| 26 #include "net/log/test_net_log.h" | 25 #include "net/log/test_net_log.h" |
| 27 #include "net/socket/client_socket_handle.h" | 26 #include "net/socket/client_socket_handle.h" |
| 28 #include "net/socket/fuzzed_socket.h" | 27 #include "net/socket/fuzzed_socket.h" |
| 29 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 30 | 29 |
| 31 // Fuzzer for HttpStreamParser. | 30 // Fuzzer for HttpStreamParser. |
| 32 // | 31 // |
| 33 // |data| is used to create a FuzzedSocket. | 32 // |data| is used to create a FuzzedSocket. |
| 34 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 33 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 35 net::TestCompletionCallback callback; | 34 net::TestCompletionCallback callback; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 73 |
| 75 // Releasing the pointer to IOBuffer immediately is more likely to lead to a | 74 // Releasing the pointer to IOBuffer immediately is more likely to lead to a |
| 76 // use-after-free. | 75 // use-after-free. |
| 77 io_buffer = nullptr; | 76 io_buffer = nullptr; |
| 78 if (callback.GetResult(result) <= 0) | 77 if (callback.GetResult(result) <= 0) |
| 79 break; | 78 break; |
| 80 } | 79 } |
| 81 | 80 |
| 82 return 0; | 81 return 0; |
| 83 } | 82 } |
| OLD | NEW |