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

Unified Diff: lib/string.cc

Issue 10782016: Enforce length/size limits for variable size heap object in order to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « lib/byte_array.cc ('k') | tests/vm/vm.status » ('j') | vm/dart_api_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/string.cc
===================================================================
--- lib/string.cc (revision 9641)
+++ lib/string.cc (working copy)
@@ -19,6 +19,16 @@
// Unbox the array and determine the maximum element width.
bool is_one_byte_string = true;
bool is_two_byte_string = true;
+
+ const intptr_t kMaxLen = kIntptrMax / sizeof(uint32_t);
+ if (len > kMaxLen) {
+ // This should never happen because the native argument type is an
+ // Array, which is our standard list implementation. It should
cshapiro 2012/07/19 05:49:01 This is further strengthened by the size of an arr
turnidge 2012/07/31 23:21:45 Removed. Fixed in a forthcoming CL that changes z
+ // not be able to grow so large as to trigger this.
+ FATAL1("StringBase_createFromCodePoints saw unexpectedly large len=%ld",
+ len);
+ }
+
uint32_t* temp = reinterpret_cast<uint32_t*>(
zone->Allocate(len * sizeof(uint32_t))); // NOLINT
Smi& element = Smi::Handle();
« no previous file with comments | « lib/byte_array.cc ('k') | tests/vm/vm.status » ('j') | vm/dart_api_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698