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

Side by Side Diff: webkit/plugins/ppapi/ppb_url_request_info_impl.cc

Issue 9139076: Added bounds checks to the URLLoader prefetch buffer threshhold. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_url_request_info_impl.h" 5 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "googleurl/src/url_util.h" 10 #include "googleurl/src/url_util.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const { 126 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const {
127 return 127 return
128 data().has_custom_referrer_url || 128 data().has_custom_referrer_url ||
129 data().has_custom_content_transfer_encoding || 129 data().has_custom_content_transfer_encoding ||
130 url_util::FindAndCompareScheme(data().url, "javascript", NULL); 130 url_util::FindAndCompareScheme(data().url, "javascript", NULL);
131 } 131 }
132 132
133 bool PPB_URLRequestInfo_Impl::ValidateData() { 133 bool PPB_URLRequestInfo_Impl::ValidateData() {
134 if (data().prefetch_buffer_lower_threshold < 0 ||
135 data().prefetch_buffer_upper_threshold < 0 ||
136 data().prefetch_buffer_upper_threshold <=
137 data().prefetch_buffer_lower_threshold) {
138 return false;
139 }
140
134 // Get the Resource objects for any file refs with only host resource (this 141 // Get the Resource objects for any file refs with only host resource (this
135 // is the state of the request as it comes off IPC). 142 // is the state of the request as it comes off IPC).
136 for (size_t i = 0; i < data().body.size(); ++i) { 143 for (size_t i = 0; i < data().body.size(); ++i) {
137 PPB_URLRequestInfo_Data::BodyItem& item = data().body[i]; 144 PPB_URLRequestInfo_Data::BodyItem& item = data().body[i];
138 if (item.is_file && !item.file_ref) { 145 if (item.is_file && !item.file_ref) {
139 EnterResourceNoLock<PPB_FileRef_API> enter( 146 EnterResourceNoLock<PPB_FileRef_API> enter(
140 item.file_ref_host_resource.host_resource(), false); 147 item.file_ref_host_resource.host_resource(), false);
141 if (!enter.succeeded()) 148 if (!enter.succeeded())
142 return false; 149 return false;
143 item.file_ref = enter.resource(); 150 item.file_ref = enter.resource();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 webkit_glue::FilePathToWebString(platform_path), 191 webkit_glue::FilePathToWebString(platform_path),
185 start_offset, 192 start_offset,
186 number_of_bytes, 193 number_of_bytes,
187 expected_last_modified_time); 194 expected_last_modified_time);
188 return true; 195 return true;
189 } 196 }
190 197
191 198
192 } // namespace ppapi 199 } // namespace ppapi
193 } // namespace webkit 200 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/tests/test_url_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698