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

Unified Diff: src/objects.cc

Issue 2201023004: [api] Fix possible OOB when using SetAndGrow (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 56cf5b30bf6ebdb20e5301359ef2c6c37acd9ff4..c541097a301d4acf9d30ac94900c9aaba4a4fe83 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9782,7 +9782,7 @@ Handle<FixedArray> FixedArray::SetAndGrow(Handle<FixedArray> array, int index,
int capacity = array->length();
do {
capacity = JSObject::NewElementsCapacity(capacity);
- } while (capacity < index);
+ } while (capacity <= index);
Handle<FixedArray> new_array =
array->GetIsolate()->factory()->NewUninitializedFixedArray(capacity);
array->CopyTo(0, *new_array, 0, array->length());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698