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

Side by Side Diff: components/cronet/android/url_request_adapter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_
6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_ 6 #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "net/base/chunked_upload_data_stream.h"
16 #include "net/base/request_priority.h" 17 #include "net/base/request_priority.h"
17 #include "net/http/http_request_headers.h" 18 #include "net/http/http_request_headers.h"
18 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
19 20
20 namespace net { 21 namespace net {
22 class HttpResponseHeaders;
21 class IOBufferWithSize; 23 class IOBufferWithSize;
22 class HttpResponseHeaders;
23 class UploadDataStream; 24 class UploadDataStream;
24 struct RedirectInfo; 25 struct RedirectInfo;
25 } // namespace net 26 } // namespace net
26 27
27 namespace cronet { 28 namespace cronet {
28 29
29 class URLRequestContextAdapter; 30 class URLRequestContextAdapter;
30 31
31 // An adapter from the JNI |UrlRequest| object and the Chromium |URLRequest| 32 // An adapter from the JNI |UrlRequest| object and the Chromium |URLRequest|
32 // object. 33 // object.
33 class URLRequestAdapter : public net::URLRequest::Delegate { 34 class URLRequestAdapter : public net::URLRequest::Delegate {
mef 2016/03/03 16:49:32 This is old API, do we need similar change for new
mmenke 2016/03/03 17:04:45 The new API doesn't use URLRequest::AppendData, so
34 public: 35 public:
35 // The delegate which is called when the request finishes. 36 // The delegate which is called when the request finishes.
36 class URLRequestAdapterDelegate 37 class URLRequestAdapterDelegate
37 : public base::RefCountedThreadSafe<URLRequestAdapterDelegate> { 38 : public base::RefCountedThreadSafe<URLRequestAdapterDelegate> {
38 public: 39 public:
39 virtual void OnResponseStarted(URLRequestAdapter* request) = 0; 40 virtual void OnResponseStarted(URLRequestAdapter* request) = 0;
40 virtual void OnBytesRead(URLRequestAdapter* request, int bytes_read) = 0; 41 virtual void OnBytesRead(URLRequestAdapter* request, int bytes_read) = 0;
41 virtual void OnRequestFinished(URLRequestAdapter* request) = 0; 42 virtual void OnRequestFinished(URLRequestAdapter* request) = 0;
42 virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0; 43 virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0;
43 44
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool HandleReadResult(int bytes_read); 150 bool HandleReadResult(int bytes_read);
150 151
151 URLRequestContextAdapter* context_; 152 URLRequestContextAdapter* context_;
152 scoped_refptr<URLRequestAdapterDelegate> delegate_; 153 scoped_refptr<URLRequestAdapterDelegate> delegate_;
153 GURL url_; 154 GURL url_;
154 net::RequestPriority priority_; 155 net::RequestPriority priority_;
155 std::string method_; 156 std::string method_;
156 net::HttpRequestHeaders headers_; 157 net::HttpRequestHeaders headers_;
157 scoped_ptr<net::URLRequest> url_request_; 158 scoped_ptr<net::URLRequest> url_request_;
158 scoped_ptr<net::UploadDataStream> upload_data_stream_; 159 scoped_ptr<net::UploadDataStream> upload_data_stream_;
160 scoped_ptr<net::ChunkedUploadDataStream::Writer> chunked_upload_writer_;
159 scoped_refptr<net::IOBufferWithSize> read_buffer_; 161 scoped_refptr<net::IOBufferWithSize> read_buffer_;
160 int total_bytes_read_; 162 int total_bytes_read_;
161 int error_code_; 163 int error_code_;
162 int http_status_code_; 164 int http_status_code_;
163 std::string http_status_text_; 165 std::string http_status_text_;
164 std::string content_type_; 166 std::string content_type_;
165 bool canceled_; 167 bool canceled_;
166 int64_t expected_size_; 168 int64_t expected_size_;
167 bool chunked_upload_; 169 bool chunked_upload_;
168 // Indicates whether redirect has been disabled. 170 // Indicates whether redirect has been disabled.
169 bool disable_redirect_; 171 bool disable_redirect_;
170 172
171 DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter); 173 DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter);
172 }; 174 };
173 175
174 } // namespace cronet 176 } // namespace cronet
175 177
176 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_ 178 #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/url_request_adapter.cc » ('j') | components/cronet/android/url_request_adapter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698