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

Unified Diff: components/html_viewer/web_url_loader_impl.cc

Issue 1096243004: Perform a sizet->int checked_cast in WebURLLoaderImpl::OnReceiveWebBlobData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment typo. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/web_url_loader_impl.cc
diff --git a/components/html_viewer/web_url_loader_impl.cc b/components/html_viewer/web_url_loader_impl.cc
index b4874b2f97f5b2272274c9eadcebe3b4d43e05c1..f9bd9a25b4290be56027b59dca9a032aca48aa8f 100644
--- a/components/html_viewer/web_url_loader_impl.cc
+++ b/components/html_viewer/web_url_loader_impl.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
#include "components/html_viewer/blink_url_request_type_converters.h"
@@ -250,8 +251,8 @@ void WebURLLoaderImpl::OnReceiveWebBlobData(
// Send a receive data for each blob item.
for (size_t i = 0; i < items.size(); ++i) {
- client_->didReceiveData(this, items[i]->data.data(), items[i]->data.size(),
- -1);
+ const int data_size = base::checked_cast<int>(items[i]->data.size());
+ client_->didReceiveData(this, items[i]->data.data(), data_size, -1);
}
// Send a closing finish.
@@ -270,7 +271,7 @@ void WebURLLoaderImpl::ReadMore() {
if (rv == MOJO_RESULT_OK) {
base::WeakPtr<WebURLLoaderImpl> self(weak_factory_.GetWeakPtr());
client_->didReceiveData(this, static_cast<const char*>(buf), buf_size, -1);
- // We may have been deleted durining didReceiveData.
+ // We may have been deleted during didReceiveData.
if (!self)
return;
EndReadDataRaw(response_body_stream_.get(), buf_size);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698