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

Unified Diff: Source/core/fileapi/FileReaderLoader.cpp

Issue 206243002: Check if ArrayBuffer allocation in ArrayBufferBuilder is successful. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/wtf/ArrayBufferBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/FileReaderLoader.cpp
diff --git a/Source/core/fileapi/FileReaderLoader.cpp b/Source/core/fileapi/FileReaderLoader.cpp
index 617dca714e5b7db823d338419e7eeec0a6229ae0..74e518bcb39cfff9711272e55bbfcaecf3aa1a4d 100644
--- a/Source/core/fileapi/FileReaderLoader.cpp
+++ b/Source/core/fileapi/FileReaderLoader.cpp
@@ -201,18 +201,20 @@ void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse&
return;
}
- if (initialBufferLength < 0) {
+ if (initialBufferLength < 0)
m_rawData = adoptPtr(new ArrayBufferBuilder());
- } else {
+ else
m_rawData = adoptPtr(new ArrayBufferBuilder(static_cast<unsigned>(initialBufferLength)));
- // Total size is known. Set m_rawData to ignore overflowed data.
- m_rawData->setVariableCapacity(false);
- }
- if (!m_rawData) {
+ if (!m_rawData || !m_rawData->isValid()) {
failed(FileError::NOT_READABLE_ERR);
return;
}
+
+ if (initialBufferLength >= 0) {
+ // Total size is known. Set m_rawData to ignore overflowed data.
+ m_rawData->setVariableCapacity(false);
+ }
}
if (m_client)
« no previous file with comments | « no previous file | Source/wtf/ArrayBufferBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698