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

Unified Diff: Source/WTF/wtf/ByteArray.cpp

Issue 10270008: Merge 114209 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 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: Source/WTF/wtf/ByteArray.cpp
===================================================================
--- Source/WTF/wtf/ByteArray.cpp (revision 115618)
+++ Source/WTF/wtf/ByteArray.cpp (working copy)
@@ -32,6 +32,9 @@
PassRefPtr<ByteArray> ByteArray::create(size_t size)
{
+ if (size > (std::numeric_limits<size_t>::max() - OBJECT_OFFSETOF(ByteArray, m_data)))
+ CRASH();
+
unsigned char* buffer = new unsigned char[size + OBJECT_OFFSETOF(ByteArray, m_data)];
ASSERT((reinterpret_cast<size_t>(buffer) & 3) == 0);
return adoptRef(new (NotNull, buffer) ByteArray(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