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

Unified Diff: runtime/vm/class_table.cc

Issue 243133004: Check for class id overflow to exit rather than crash. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_table.cc
===================================================================
--- runtime/vm/class_table.cc (revision 35144)
+++ runtime/vm/class_table.cc (working copy)
@@ -89,6 +89,10 @@
class_heap_stats_table_ = new_stats_table;
}
ASSERT(top_ < capacity_);
+ if (!Class::is_valid_id(top_)) {
+ FATAL1("Fatal error in ClassTable::Register: invalid index %" Pd "\n",
Ivan Posva 2014/04/18 16:39:27 FATAL is OK for now, but we really should just thr
+ top_);
+ }
cls.set_id(top_);
table_[top_] = cls.raw();
top_++; // Increment next index.
@@ -102,7 +106,7 @@
if (index >= capacity_) {
// Grow the capacity of the class table.
intptr_t new_capacity = index + capacity_increment_;
- if (new_capacity < capacity_) {
+ if (!Class::is_valid_id(index) || new_capacity < capacity_) {
FATAL1("Fatal error in ClassTable::Register: invalid index %" Pd "\n",
index);
}
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698