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

Unified Diff: src/builtins.cc

Issue 1782443002: Ensure appropriate bounds checking for Array subclass concat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/regress/regress-crbug-592340.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 5f062e1c95c0af883ccc898e8b42310b7ff252bf..e3dcd225d099032267ad289dff30ed8376c7c607 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -671,14 +671,6 @@ class ArrayConcatVisitor {
bool visit(uint32_t i, Handle<Object> elm) {
uint32_t index = index_offset_ + i;
- if (!is_fixed_array()) {
- Handle<Object> element_value;
- ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate_, element_value,
- Object::SetElement(isolate_, storage_, index, elm, STRICT), false);
- return true;
- }
-
if (i >= JSObject::kMaxElementCount - index_offset_) {
set_exceeds_array_limit(true);
// Exception hasn't been thrown at this point. Return true to
@@ -687,6 +679,14 @@ class ArrayConcatVisitor {
return true;
}
+ if (!is_fixed_array()) {
+ Handle<Object> element_value;
+ ASSIGN_RETURN_ON_EXCEPTION_VALUE(
+ isolate_, element_value,
+ Object::SetElement(isolate_, storage_, index, elm, STRICT), false);
+ return true;
+ }
+
if (fast_elements()) {
if (index < static_cast<uint32_t>(storage_fixed_array()->length())) {
storage_fixed_array()->set(index, *elm);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-592340.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698