Changeset 251274 in webkit
- Timestamp:
- Oct 17, 2019, 9:35:28 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r251271 r251274 1 2019-10-17 Mark Lam <mark.lam@apple.com> 2 3 Add missing checks after calls to the sameValue() JSValue comparator. 4 https://bugs.webkit.org/show_bug.cgi?id=203126 5 <rdar://problem/56366561> 6 7 Reviewed by Saam Barati. 8 9 * stress/validate-exception-check-in-proxy-object-put.js: Added. 10 1 11 2019-10-17 Saam Barati <sbarati@apple.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r251271 r251274 1 2019-10-17 Mark Lam <mark.lam@apple.com> 2 3 Add missing checks after calls to the sameValue() JSValue comparator. 4 https://bugs.webkit.org/show_bug.cgi?id=203126 5 <rdar://problem/56366561> 6 7 Reviewed by Saam Barati. 8 9 * runtime/JSFunction.cpp: 10 (JSC::JSFunction::defineOwnProperty): 11 * runtime/JSObject.cpp: 12 (JSC::JSObject::defineOwnIndexedProperty): 13 (JSC::validateAndApplyPropertyDescriptor): 14 * runtime/PropertyDescriptor.cpp: 15 (JSC::PropertyDescriptor::equalTo const): 16 * runtime/ProxyObject.cpp: 17 (JSC::performProxyGet): 18 (JSC::ProxyObject::performPut): 19 (JSC::ProxyObject::performSetPrototype): 20 (JSC::ProxyObject::performGetPrototype): 21 * runtime/RegExpObject.cpp: 22 (JSC::RegExpObject::defineOwnProperty): 23 1 24 2019-10-17 Saam Barati <sbarati@apple.com> 2 25 -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r250803 r251274 592 592 RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException)); 593 593 594 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveArguments(exec, thisObject)); 594 valueCheck = !descriptor.value(); 595 if (!valueCheck) { 596 valueCheck = sameValue(exec, descriptor.value(), retrieveArguments(exec, thisObject)); 597 RETURN_IF_EXCEPTION(scope, false); 598 } 595 599 } else if (propertyName == vm.propertyNames->caller) { 596 600 if (!thisObject->jsExecutable()->hasCallerAndArgumentsProperties()) 597 601 RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException)); 598 602 599 valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveCallerFunction(exec, thisObject)); 603 valueCheck = !descriptor.value(); 604 if (!valueCheck) { 605 valueCheck = sameValue(exec, descriptor.value(), retrieveCallerFunction(exec, thisObject)); 606 RETURN_IF_EXCEPTION(scope, false); 607 } 600 608 } else { 601 609 thisObject->reifyLazyPropertyIfNeeded(vm, exec, propertyName); -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r250803 r251274 2684 2684 // 10.a.ii. If the [[Writable]] field of current is false, then 2685 2685 // 10.a.ii.1. Reject, if the [[Value]] field of Desc is present and SameValue(Desc.[[Value]], current.[[Value]]) is false. 2686 if (descriptor.value() && !sameValue(exec, descriptor.value(), current.value())) 2687 return typeError(exec, scope, throwException, ReadonlyPropertyChangeError); 2686 if (descriptor.value()) { 2687 bool isSame = sameValue(exec, descriptor.value(), current.value()); 2688 RETURN_IF_EXCEPTION(scope, false); 2689 if (!isSame) 2690 return typeError(exec, scope, throwException, ReadonlyPropertyChangeError); 2691 } 2688 2692 } 2689 2693 // 10.b. else, the [[Configurable]] field of current is true, so any change is acceptable. … … 3642 3646 return typeError(exec, scope, throwException, UnconfigurablePropertyChangeWritabilityError); 3643 3647 if (!current.writable()) { 3644 if (descriptor.value() && !sameValue(exec, current.value(), descriptor.value())) 3645 return typeError(exec, scope, throwException, ReadonlyPropertyChangeError); 3648 if (descriptor.value()) { 3649 bool isSame = sameValue(exec, current.value(), descriptor.value()); 3650 RETURN_IF_EXCEPTION(scope, false); 3651 if (!isSame) 3652 return typeError(exec, scope, throwException, ReadonlyPropertyChangeError); 3653 } 3646 3654 } 3647 3655 } -
trunk/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp
r239062 r251274 1 1 /* 2 * Copyright (C) 2009 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2009-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 196 196 bool PropertyDescriptor::equalTo(ExecState* exec, const PropertyDescriptor& other) const 197 197 { 198 VM& vm = exec->vm(); 199 auto scope = DECLARE_THROW_SCOPE(vm); 198 200 if (other.m_value.isEmpty() != m_value.isEmpty() 199 201 || other.m_getter.isEmpty() != m_getter.isEmpty() 200 202 || other.m_setter.isEmpty() != m_setter.isEmpty()) 201 203 return false; 202 return (!m_value || sameValue(exec, other.m_value, m_value)) 203 && (!m_getter || JSValue::strictEqual(exec, other.m_getter, m_getter)) 204 if (m_value) { 205 bool isSame = sameValue(exec, other.m_value, m_value); 206 RETURN_IF_EXCEPTION(scope, false); 207 if (!isSame) 208 return false; 209 } 210 return (!m_getter || JSValue::strictEqual(exec, other.m_getter, m_getter)) 204 211 && (!m_setter || JSValue::strictEqual(exec, other.m_setter, m_setter)) 205 212 && attributesEqual(other); -
trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp
r250803 r251274 178 178 if (result) { 179 179 if (descriptor.isDataDescriptor() && !descriptor.configurable() && !descriptor.writable()) { 180 if (!sameValue(exec, descriptor.value(), trapResult)) 180 bool isSame = sameValue(exec, descriptor.value(), trapResult); 181 RETURN_IF_EXCEPTION(scope, { }); 182 if (!isSame) 181 183 return throwTypeError(exec, scope, "Proxy handler's 'get' result of a non-configurable and non-writable property should be the same value as the target's property"_s); 182 184 } else if (descriptor.isAccessorDescriptor() && !descriptor.configurable() && descriptor.getter().isUndefined()) { … … 466 468 if (hasProperty) { 467 469 if (descriptor.isDataDescriptor() && !descriptor.configurable() && !descriptor.writable()) { 468 if (!sameValue(exec, descriptor.value(), putValue)) { 470 bool isSame = sameValue(exec, descriptor.value(), putValue); 471 RETURN_IF_EXCEPTION(scope, false); 472 if (!isSame) { 469 473 throwVMTypeError(exec, scope, "Proxy handler's 'set' on a non-configurable and non-writable property on 'target' should either return false or be the same value already on the 'target'"_s); 470 474 return false; … … 1148 1152 JSValue targetPrototype = target->getPrototype(vm, exec); 1149 1153 RETURN_IF_EXCEPTION(scope, false); 1150 if (!sameValue(exec, prototype, targetPrototype)) { 1154 bool isSame = sameValue(exec, prototype, targetPrototype); 1155 RETURN_IF_EXCEPTION(scope, false); 1156 if (!isSame) { 1151 1157 throwVMTypeError(exec, scope, "Proxy 'setPrototypeOf' trap returned true when its target is non-extensible and the new prototype value is not the same as the current prototype value. It should have returned false"_s); 1152 1158 return false; … … 1206 1212 JSValue targetPrototype = target->getPrototype(vm, exec); 1207 1213 RETURN_IF_EXCEPTION(scope, { }); 1208 if (!sameValue(exec, targetPrototype, trapResult)) { 1214 bool isSame = sameValue(exec, targetPrototype, trapResult); 1215 RETURN_IF_EXCEPTION(scope, { }); 1216 if (!isSame) { 1209 1217 throwVMTypeError(exec, scope, "Proxy's 'getPrototypeOf' trap for a non-extensible target should return the same value as the target's prototype"_s); 1210 1218 return { }; -
trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp
r243364 r251274 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003-201 8Apple Inc. All Rights Reserved.3 * Copyright (C) 2003-2019 Apple Inc. All Rights Reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 120 120 if (descriptor.writablePresent() && descriptor.writable()) 121 121 return typeError(exec, scope, shouldThrow, UnconfigurablePropertyChangeWritabilityError); 122 if (descriptor.value() && !sameValue(exec, regExp->getLastIndex(), descriptor.value())) 123 return typeError(exec, scope, shouldThrow, ReadonlyPropertyChangeError); 122 if (descriptor.value()) { 123 bool isSame = sameValue(exec, regExp->getLastIndex(), descriptor.value()); 124 RETURN_IF_EXCEPTION(scope, false); 125 if (!isSame) 126 return typeError(exec, scope, shouldThrow, ReadonlyPropertyChangeError); 127 } 124 128 return true; 125 129 }
Note:
See TracChangeset
for help on using the changeset viewer.