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

Side by Side Diff: src/lookup.cc

Issue 1573143002: Do not leak private property names to proxy traps and interceptors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Typo Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/messages.h » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/lookup.h" 5 #include "src/lookup.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 LookupIterator::State LookupIterator::LookupInHolder(Map* const map, 603 LookupIterator::State LookupIterator::LookupInHolder(Map* const map,
604 JSReceiver* const holder) { 604 JSReceiver* const holder) {
605 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY); 605 STATIC_ASSERT(INTERCEPTOR == BEFORE_PROPERTY);
606 DisallowHeapAllocation no_gc; 606 DisallowHeapAllocation no_gc;
607 if (interceptor_state_ == InterceptorState::kProcessNonMasking) { 607 if (interceptor_state_ == InterceptorState::kProcessNonMasking) {
608 return LookupNonMaskingInterceptorInHolder(map, holder); 608 return LookupNonMaskingInterceptorInHolder(map, holder);
609 } 609 }
610 switch (state_) { 610 switch (state_) {
611 case NOT_FOUND: 611 case NOT_FOUND:
612 if (map->IsJSProxyMap()) { 612 if (map->IsJSProxyMap()) {
613 // Do not leak private property names.
613 if (!name_.is_null() && name_->IsPrivate()) return NOT_FOUND; 614 if (!name_.is_null() && name_->IsPrivate()) return NOT_FOUND;
614 return JSPROXY; 615 return JSPROXY;
615 } 616 }
616 if (map->is_access_check_needed() && 617 if (map->is_access_check_needed() &&
617 (IsElement() || !isolate_->IsInternallyUsedPropertyName(name_))) { 618 (IsElement() || !isolate_->IsInternallyUsedPropertyName(name_))) {
618 return ACCESS_CHECK; 619 return ACCESS_CHECK;
619 } 620 }
620 // Fall through. 621 // Fall through.
621 case ACCESS_CHECK: 622 case ACCESS_CHECK:
622 if (exotic_index_state_ != ExoticIndexState::kNotExotic && 623 if (exotic_index_state_ != ExoticIndexState::kNotExotic &&
623 holder->IsJSTypedArray() && IsIntegerIndexedExotic(holder)) { 624 holder->IsJSTypedArray() && IsIntegerIndexedExotic(holder)) {
624 return INTEGER_INDEXED_EXOTIC; 625 return INTEGER_INDEXED_EXOTIC;
625 } 626 }
626 if (check_interceptor() && HasInterceptor(map) && 627 if (check_interceptor() && HasInterceptor(map) &&
627 !SkipInterceptor(JSObject::cast(holder))) { 628 !SkipInterceptor(JSObject::cast(holder))) {
629 // Do not leak private property names.
630 if (!name_.is_null() && name_->IsPrivate()) return NOT_FOUND;
628 return INTERCEPTOR; 631 return INTERCEPTOR;
629 } 632 }
630 // Fall through. 633 // Fall through.
631 case INTERCEPTOR: 634 case INTERCEPTOR:
632 if (IsElement()) { 635 if (IsElement()) {
633 // TODO(verwaest): Optimize. 636 // TODO(verwaest): Optimize.
634 if (holder->IsStringObjectWithCharacterAt(index_)) { 637 if (holder->IsStringObjectWithCharacterAt(index_)) {
635 PropertyAttributes attributes = 638 PropertyAttributes attributes =
636 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); 639 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
637 property_details_ = PropertyDetails(attributes, v8::internal::DATA, 0, 640 property_details_ = PropertyDetails(attributes, v8::internal::DATA, 0,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 // Fall through. 705 // Fall through.
703 default: 706 default:
704 return NOT_FOUND; 707 return NOT_FOUND;
705 } 708 }
706 UNREACHABLE(); 709 UNREACHABLE();
707 return state_; 710 return state_;
708 } 711 }
709 712
710 } // namespace internal 713 } // namespace internal
711 } // namespace v8 714 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/messages.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698