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

Unified Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 618583002: Correct data size argument type in resource loading path to unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 69986e041d2e82d180eab8f692b98c05f61ad237..d28dfcec50708497ec5ec07d66f17876ac1287a2 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -67,6 +67,7 @@
#include "wtf/RefCountedLeakCounter.h"
#include "wtf/StdLibExtras.h"
#include "wtf/text/CString.h"
+#include <limits.h>
namespace blink {
@@ -1392,7 +1393,7 @@ void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const Resource
m_finalResponseCharset = response.textEncodingName();
}
-void XMLHttpRequest::parseDocumentChunk(const char* data, int len)
+void XMLHttpRequest::parseDocumentChunk(const char* data, unsigned len)
{
if (!m_responseDocumentParser) {
ASSERT(!m_responseDocument);
@@ -1436,7 +1437,7 @@ PassOwnPtr<TextResourceDecoder> XMLHttpRequest::createDecoder() const
return TextResourceDecoder::create("text/plain", "UTF-8");
}
-void XMLHttpRequest::didReceiveData(const char* data, int len)
+void XMLHttpRequest::didReceiveData(const char* data, unsigned len)
{
ASSERT(!m_downloadingToFile);
@@ -1454,9 +1455,6 @@ void XMLHttpRequest::didReceiveData(const char* data, int len)
if (!len)
return;
- if (len == -1)
- len = strlen(data);
-
if (m_responseTypeCode == ResponseTypeDocument && responseIsHTML()) {
parseDocumentChunk(data, len);
} else if (m_responseTypeCode == ResponseTypeDefault || m_responseTypeCode == ResponseTypeText || m_responseTypeCode == ResponseTypeJSON || m_responseTypeCode == ResponseTypeDocument) {
@@ -1481,6 +1479,8 @@ void XMLHttpRequest::didReceiveData(const char* data, int len)
m_responseStream->enqueue(ArrayBuffer::create(data, len));
}
+ ASSERT(len <= INT_MAX);
+
trackProgress(len);
}

Powered by Google App Engine
This is Rietveld 408576698