Commit f6af4e19 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Avoid integer overflow in CopyMap.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/63173023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17740 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 230d5bf3
......@@ -626,11 +626,12 @@ Handle<Map> Factory::CopyMap(Handle<Map> src,
int instance_size_delta = extra_inobject_properties * kPointerSize;
int max_instance_size_delta =
JSObject::kMaxInstanceSize - copy->instance_size();
if (instance_size_delta > max_instance_size_delta) {
int max_extra_properties = max_instance_size_delta >> kPointerSizeLog2;
if (extra_inobject_properties > max_extra_properties) {
// If the instance size overflows, we allocate as many properties
// as we can as inobject properties.
instance_size_delta = max_instance_size_delta;
extra_inobject_properties = max_instance_size_delta >> kPointerSizeLog2;
extra_inobject_properties = max_extra_properties;
}
// Adjust the map with the extra inobject properties.
int inobject_properties =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment