Changeset 287546 in webkit
- Timestamp:
- Jan 3, 2022 9:46:10 AM (7 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/intl-pluralrules-select-range-validate-inputs.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/IntlPluralRules.cpp (modified) (1 diff)
-
Source/JavaScriptCore/runtime/IntlPluralRulesPrototype.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r287545 r287546 1 2022-01-03 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Fix Intl.PluralRules.selectRange input validation 4 https://bugs.webkit.org/show_bug.cgi?id=234817 5 6 Reviewed by Alexey Shvayka. 7 8 * stress/intl-pluralrules-select-range-validate-inputs.js: Added. 9 (shouldThrow): 10 (Intl.PluralRules.prototype.selectRange.shouldThrow): 11 1 12 2022-01-03 Yusuke Suzuki <ysuzuki@apple.com> 2 13 -
trunk/Source/JavaScriptCore/ChangeLog
r287545 r287546 1 2022-01-03 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Fix Intl.PluralRules.selectRange input validation 4 https://bugs.webkit.org/show_bug.cgi?id=234817 5 6 Reviewed by Alexey Shvayka. 7 8 Add specified argument validation[1] to Intl.PluralRules.selectRange. 9 10 [1]: https://tc39.es/proposal-intl-numberformat-v3/out/pluralrules/proposed.html#sec-intl.pluralrules.prototype.selectrange 11 12 * runtime/IntlPluralRules.cpp: 13 (JSC::IntlPluralRules::selectRange const): 14 * runtime/IntlPluralRulesPrototype.cpp: 15 (JSC::JSC_DEFINE_HOST_FUNCTION): 16 1 17 2022-01-03 Yusuke Suzuki <ysuzuki@apple.com> 2 18 -
trunk/Source/JavaScriptCore/runtime/IntlPluralRules.cpp
r285730 r287546 280 280 auto scope = DECLARE_THROW_SCOPE(vm); 281 281 282 if (start > end) { 283 throwRangeError(globalObject, scope, "start is larger than end"_s); 284 return { }; 285 } 282 if (std::isnan(start) || std::isnan(end)) 283 return throwRangeError(globalObject, scope, "Passed numbers are out of range"_s); 284 285 if (end < start) 286 return throwRangeError(globalObject, scope, "start is larger than end"_s); 287 288 if (isNegativeZero(end) && start >= 0) 289 return throwRangeError(globalObject, scope, "start is larger than end"_s); 286 290 287 291 UErrorCode status = U_ZERO_ERROR; -
trunk/Source/JavaScriptCore/runtime/IntlPluralRulesPrototype.cpp
r287543 r287546 111 111 return JSValue::encode(throwTypeError(globalObject, scope, "Intl.PluralRules.prototype.selectRange called on value that's not a PluralRules"_s)); 112 112 113 double start = callFrame->argument(0).toNumber(globalObject); 113 JSValue startValue = callFrame->argument(0); 114 JSValue endValue = callFrame->argument(1); 115 116 if (startValue.isUndefined() || endValue.isUndefined()) 117 return throwVMTypeError(globalObject, scope, "start or end is undefined"_s); 118 119 double start = startValue.toNumber(globalObject); 114 120 RETURN_IF_EXCEPTION(scope, { }); 115 121 116 double end = callFrame->argument(1).toNumber(globalObject);122 double end = endValue.toNumber(globalObject); 117 123 RETURN_IF_EXCEPTION(scope, { }); 118 124
Note: See TracChangeset
for help on using the changeset viewer.