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

Unified Diff: src/runtime/runtime-array.cc

Issue 1218503002: Add bounds-checking in runtime implementations of %FixedArray{Get,Set} (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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-504786.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index 1617245daf3206fce4638c57e388f88c226f7f8a..a7542ecb2ed9f7391c15c5daee16b3b44687e655 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -58,19 +58,21 @@ RUNTIME_FUNCTION(Runtime_SpecialArrayFunctions) {
RUNTIME_FUNCTION(Runtime_FixedArrayGet) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 2);
- CONVERT_ARG_CHECKED(FixedArray, object, 0);
+ CONVERT_ARG_CHECKED(FixedArray, array, 0);
CONVERT_SMI_ARG_CHECKED(index, 1);
- return object->get(index);
+ RUNTIME_ASSERT(index < array->length());
+ return array->get(index);
}
RUNTIME_FUNCTION(Runtime_FixedArraySet) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 3);
- CONVERT_ARG_CHECKED(FixedArray, object, 0);
+ CONVERT_ARG_CHECKED(FixedArray, array, 0);
CONVERT_SMI_ARG_CHECKED(index, 1);
CONVERT_ARG_CHECKED(Object, value, 2);
- object->set(index, value);
+ RUNTIME_ASSERT(index < array->length());
+ array->set(index, value);
return isolate->heap()->undefined_value();
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-504786.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698