Commit 230d5bf3 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Runtime CHECK for overflow in NewTypedArray.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/62713006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17739 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent aefa2a21
...@@ -6132,8 +6132,10 @@ i::Handle<i::JSTypedArray> NewTypedArray( ...@@ -6132,8 +6132,10 @@ i::Handle<i::JSTypedArray> NewTypedArray(
ASSERT(byte_offset % sizeof(ElementType) == 0); ASSERT(byte_offset % sizeof(ElementType) == 0);
CHECK(length <= (std::numeric_limits<size_t>::max() / sizeof(ElementType)));
size_t byte_length = length * sizeof(ElementType);
SetupArrayBufferView( SetupArrayBufferView(
isolate, obj, buffer, byte_offset, length * sizeof(ElementType)); isolate, obj, buffer, byte_offset, byte_length);
i::Handle<i::Object> length_object = i::Handle<i::Object> length_object =
isolate->factory()->NewNumberFromSize(length); isolate->factory()->NewNumberFromSize(length);
......
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