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

Unified Diff: src/objects.cc

Issue 861773002: Perform access checks on the prototype chain when setting an element through a setter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 years, 11 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 72fecad05a24cf6322dbde0c8a50504822d12626..c119e3535afdf2fa36f6bfb3ea2c119e5c2b947f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2976,7 +2976,7 @@ MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
Handle<Object> value,
bool* found,
StrictMode strict_mode) {
- Isolate *isolate = object->GetIsolate();
+ Isolate* isolate = object->GetIsolate();
for (PrototypeIterator iter(isolate, object); !iter.IsAtEnd();
iter.Advance()) {
if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
@@ -2987,9 +2987,20 @@ MaybeHandle<Object> JSObject::SetElementWithCallbackSetterInPrototypes(
}
Handle<JSObject> js_proto =
Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter));
+
+ if (js_proto->IsAccessCheckNeeded()) {
+ if (!isolate->MayIndexedAccess(js_proto, index, v8::ACCESS_SET)) {
+ *found = true;
+ isolate->ReportFailedAccessCheck(js_proto, v8::ACCESS_SET);
+ RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
+ return MaybeHandle<Object>();
+ }
+ }
+
if (!js_proto->HasDictionaryElements()) {
continue;
}
+
Handle<SeededNumberDictionary> dictionary(js_proto->element_dictionary());
int entry = dictionary->FindEntry(index);
if (entry != SeededNumberDictionary::kNotFound) {
« 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