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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 1571233003: Fix errors caused by unsafe conversions to/from size_t (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improved ALLOW_NUMERIC_ARG_TYPES_PROMOTABLE_TO Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index 2130a3e72e4d06321bc285a315389a15cd616edb..a720a08c58adb28155936ea3c60061919ebd7fa1 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -647,7 +647,7 @@ void DocumentThreadableLoader::setSerializedCachedMetadata(Resource*, const char
// |this| may be dead here.
}
-void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data, unsigned dataLength)
+void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data, size_t dataLength)
{
ASSERT_UNUSED(resource, resource == this->resource());
ASSERT(m_async);
@@ -655,11 +655,13 @@ void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data
if (m_isUsingDataConsumerHandle)
return;
- handleReceivedData(data, dataLength);
+ // TODO(junov): Fix the ThreadableLoader ecosystem to use size_t.
+ // Until then, we use safeCast to trap potential overflows.
+ handleReceivedData(data, safeCast<unsigned>(dataLength));
// |this| may be dead here.
}
-void DocumentThreadableLoader::handleReceivedData(const char* data, unsigned dataLength)
+void DocumentThreadableLoader::handleReceivedData(const char* data, size_t dataLength)
{
ASSERT(m_client);

Powered by Google App Engine
This is Rietveld 408576698