Commit bdb4e2cb authored by cbruni's avatar cbruni Committed by Commit bot

[api] Fix possible OOB when using SetAndGrow

R=jkummerow@chromium.org
BUG=chromium:630217

Review-Url: https://codereview.chromium.org/2201023004
Cr-Commit-Position: refs/heads/master@{#38287}
parent f813494f
...@@ -9782,7 +9782,7 @@ Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index, ...@@ -9782,7 +9782,7 @@ Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
int capacity = array->length(); int capacity = array->length();
do { do {
capacity = JSObject::NewElementsCapacity(capacity); capacity = JSObject::NewElementsCapacity(capacity);
} while (capacity < index); } while (capacity <= index);
Handle<FixedArray> new_array = Handle<FixedArray> new_array =
array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity); array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity);
array->CopyTo(0, *new_array, 0, array->length()); array->CopyTo(0, *new_array, 0, array->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