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

Side by Side Diff: net/url_request/url_fetcher_core.h

Issue 1732493002: Prevent URLFetcher::AppendChunkedData from dereferencing NULL pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Cronet Created 4 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_URL_REQUEST_URL_FETCHER_CORE_H_ 5 #ifndef NET_URL_REQUEST_URL_FETCHER_CORE_H_
6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/debug/stack_trace.h" 14 #include "base/debug/stack_trace.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
21 #include "net/base/chunked_upload_data_stream.h"
21 #include "net/base/host_port_pair.h" 22 #include "net/base/host_port_pair.h"
22 #include "net/http/http_request_headers.h" 23 #include "net/http/http_request_headers.h"
23 #include "net/url_request/url_fetcher.h" 24 #include "net/url_request/url_fetcher.h"
24 #include "net/url_request/url_request.h" 25 #include "net/url_request/url_request.h"
25 #include "net/url_request/url_request_context_getter_observer.h" 26 #include "net/url_request/url_request_context_getter_observer.h"
26 #include "net/url_request/url_request_status.h" 27 #include "net/url_request/url_request_status.h"
27 #include "url/gurl.h" 28 #include "url/gurl.h"
28 29
29 namespace base { 30 namespace base {
30 class SingleThreadTaskRunner; 31 class SingleThreadTaskRunner;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 base::FilePath upload_file_path_; // Path to file containing POST payload 265 base::FilePath upload_file_path_; // Path to file containing POST payload
265 uint64_t upload_range_offset_; // Offset from the beginning of the file 266 uint64_t upload_range_offset_; // Offset from the beginning of the file
266 // to be uploaded. 267 // to be uploaded.
267 uint64_t upload_range_length_; // The length of the part of file to be 268 uint64_t upload_range_length_; // The length of the part of file to be
268 // uploaded. 269 // uploaded.
269 URLFetcher::CreateUploadStreamCallback 270 URLFetcher::CreateUploadStreamCallback
270 upload_stream_factory_; // Callback to create HTTP POST payload. 271 upload_stream_factory_; // Callback to create HTTP POST payload.
271 std::string upload_content_type_; // MIME type of POST payload 272 std::string upload_content_type_; // MIME type of POST payload
272 std::string referrer_; // HTTP Referer header value and policy 273 std::string referrer_; // HTTP Referer header value and policy
273 URLRequest::ReferrerPolicy referrer_policy_; 274 URLRequest::ReferrerPolicy referrer_policy_;
274 bool is_chunked_upload_; // True if using chunked transfer encoding 275 bool is_chunked_upload_; // True if using chunked transfer encoding
mef 2016/03/03 16:49:32 do we need this bool or could it be replaced by ch
mmenke 2016/03/03 17:04:45 ChunkedUploadDataStreams are non-thread-safe, and
mef 2016/03/08 17:19:22 So, if URLFetcher is re-used, would we need to cre
mmenke 2016/03/09 17:35:00 Oops...Missed this. Yes, we would.
275 276
277 // Used to write to |chunked_stream|, even after ownership has been passed to
278 // the URLRequest. Continues to be valid even after the request deletes its
279 // upload data.
280 scoped_ptr<ChunkedUploadDataStream::Writer> chunked_stream_writer_;
281
282 // Temporary storage of ChunkedUploadDataStream, before request is created.
283 scoped_ptr<ChunkedUploadDataStream> chunked_stream_;
284
276 // Used to determine how long to wait before making a request or doing a 285 // Used to determine how long to wait before making a request or doing a
277 // retry. 286 // retry.
278 // 287 //
279 // Both of them can only be accessed on the IO thread. 288 // Both of them can only be accessed on the IO thread.
280 // 289 //
281 // To determine the proper backoff timing, throttler entries for 290 // To determine the proper backoff timing, throttler entries for
282 // both |original_URL| and |url| are needed. For example, consider 291 // both |original_URL| and |url| are needed. For example, consider
283 // the case that URL A redirects to URL B, for which the server 292 // the case that URL A redirects to URL B, for which the server
284 // returns a 500 response. In this case, the exponential back-off 293 // returns a 500 response. In this case, the exponential back-off
285 // release time of URL A won't increase. If only the backoff 294 // release time of URL A won't increase. If only the backoff
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 base::debug::StackTrace stack_trace_; 351 base::debug::StackTrace stack_trace_;
343 352
344 static base::LazyInstance<Registry> g_registry; 353 static base::LazyInstance<Registry> g_registry;
345 354
346 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); 355 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore);
347 }; 356 };
348 357
349 } // namespace net 358 } // namespace net
350 359
351 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ 360 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698