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

Unified Diff: src/elements.cc

Issue 2297253002: [elements] Fix GetEntryForIndexImpl to honor array length (Closed)
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 | test/mjsunit/element-accessor.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index b4396dd90b7ff0c31c36fe41361365f4bb6e15fe..390af2c0f27b6389e09551512bef18e27d848c2c 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -1189,13 +1189,13 @@ class ElementsAccessorBase : public ElementsAccessor {
static uint32_t GetEntryForIndexImpl(JSObject* holder,
FixedArrayBase* backing_store,
uint32_t index, PropertyFilter filter) {
+ uint32_t length = Subclass::GetMaxIndex(holder, backing_store);
if (IsHoleyElementsKind(kind())) {
- return index < Subclass::GetCapacityImpl(holder, backing_store) &&
+ return index < length &&
!BackingStore::cast(backing_store)->is_the_hole(index)
? index
: kMaxUInt32;
} else {
- uint32_t length = Subclass::GetMaxIndex(holder, backing_store);
return index < length ? index : kMaxUInt32;
}
}
« no previous file with comments | « no previous file | test/mjsunit/element-accessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698