1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00
serenity/Userland/Libraries/LibJS/Runtime/Intl
Timothy Flynn 9e50f25ac4 LibJS: Prevent i64 overflow when computing large NumberFormat exponents
The largest exponents we compute are on the order of 10^21 (governed by
the maximumSignificantDigits option, which has a max value of 21). That
is too large to fit into the i64 we were using when multiplying this
exponent by the value to be formatted.

Instead, split up the logic to multiply that value by this exponent
based on the value's underlying type:

Number: Do not cast the result of pow() to an i64, and perform the
follow-up multiplication with doubles.

BigInt: Do not use pow(). Instead, compute the exponent as a BigInt
from the start, then perform the follow-up multiplication with that
BigInt.
2022-07-18 08:51:07 +01:00
..
AbstractOperations.cpp LibJS: Allow specifying keyword values not directly defined for a locale 2022-07-15 12:31:43 +02:00
AbstractOperations.h LibJS+js: Parse new constructor options from Intl.NumberFormat V3 2022-07-13 19:22:26 +01:00
Collator.cpp LibJS: Implement get Intl.Collator.prototype.compare 2022-02-20 22:05:59 -05:00
Collator.h LibJS: Reorganize spec steps for Intl.Collator 2022-03-15 17:30:58 +01:00
CollatorCompareFunction.cpp LibJS: Define the Intl.Collator's compare function name to be empty 2022-02-21 16:30:19 +00:00
CollatorCompareFunction.h LibJS: Add an initial implementation of Collator Compare Functions 2022-02-20 22:05:59 -05:00
CollatorConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
CollatorConstructor.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
CollatorPrototype.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
CollatorPrototype.h LibJS: Implement get Intl.Collator.prototype.compare 2022-02-20 22:05:59 -05:00
DateTimeFormat.cpp AK: Use an enum instead of a bool for String::replace(all_occurences) 2022-07-06 11:12:45 +02:00
DateTimeFormat.h LibJS: Convert remaining Date AOs using JS::Value as in/output to double 2022-05-06 22:32:47 +02:00
DateTimeFormatConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
DateTimeFormatConstructor.h LibJS: Reorganize spec steps for Intl.DateTimeFormat 2022-03-15 17:30:58 +01:00
DateTimeFormatFunction.cpp LibJS: Convert remaining Date AOs using JS::Value as in/output to double 2022-05-06 22:32:47 +02:00
DateTimeFormatFunction.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
DateTimeFormatPrototype.cpp LibJS: Convert remaining Date AOs using JS::Value as in/output to double 2022-05-06 22:32:47 +02:00
DateTimeFormatPrototype.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
DisplayNames.cpp LibJS: Remove a bunch of gratuitous JS namespace qualifiers 2022-04-03 15:19:33 +01:00
DisplayNames.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
DisplayNamesConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
DisplayNamesConstructor.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
DisplayNamesPrototype.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
DisplayNamesPrototype.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
DurationFormat.cpp Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
DurationFormat.h LibJS: Disallow mixed-sign durations in Intl.DurationFormat 2022-07-02 18:32:35 +03:00
DurationFormatConstructor.cpp LibJS: Implement Intl.DurationFormat.supportedLocalesOf 2022-07-01 01:00:05 +03:00
DurationFormatConstructor.h LibJS: Implement Intl.DurationFormat.supportedLocalesOf 2022-07-01 01:00:05 +03:00
DurationFormatPrototype.cpp LibJS: Disallow mixed-sign durations in Intl.DurationFormat 2022-07-02 18:32:35 +03:00
DurationFormatPrototype.h LibJS: Implement Intl.DurationFormat.prototype.formatToParts 2022-07-01 01:00:05 +03:00
Intl.cpp LibJS: Remove hard-coded lists of collation types 2022-07-15 12:31:43 +02:00
Intl.h LibJS: Implement Intl.supportedValuesOf 2022-01-31 00:32:41 +00:00
ListFormat.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
ListFormat.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
ListFormatConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
ListFormatConstructor.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
ListFormatPrototype.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
ListFormatPrototype.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Locale.cpp LibJS: Remove hard-coded lists of collation types 2022-07-15 12:31:43 +02:00
Locale.h LibJS: Implement Intl.Locale.prototype.weekInfo property 2022-07-06 16:56:42 +02:00
LocaleConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
LocaleConstructor.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
LocalePrototype.cpp LibJS: Implement Intl.Locale.prototype.weekInfo property 2022-07-06 16:56:42 +02:00
LocalePrototype.h LibJS: Implement Intl.Locale.prototype.weekInfo property 2022-07-06 16:56:42 +02:00
NumberFormat.cpp LibJS: Prevent i64 overflow when computing large NumberFormat exponents 2022-07-18 08:51:07 +01:00
NumberFormat.h LibJS: Remove accidentally duplicated [[RoundingType]] enumeration 2022-07-18 08:51:07 +01:00
NumberFormatConstructor.cpp LibJS+js: Parse new constructor options from Intl.NumberFormat V3 2022-07-13 19:22:26 +01:00
NumberFormatConstructor.h LibJS: Reorganize spec steps for Intl.NumberFormat 2022-03-15 17:30:58 +01:00
NumberFormatFunction.cpp LibJS: Reorganize spec steps for Intl.NumberFormat 2022-03-15 17:30:58 +01:00
NumberFormatFunction.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
NumberFormatPrototype.cpp LibJS+js: Parse new constructor options from Intl.NumberFormat V3 2022-07-13 19:22:26 +01:00
NumberFormatPrototype.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
PluralRules.cpp LibJS: Implement Intl.PluralRules.prototype.selectRange 2022-07-12 00:43:34 +01:00
PluralRules.h LibJS: Implement Intl.PluralRules.prototype.selectRange 2022-07-12 00:43:34 +01:00
PluralRulesConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
PluralRulesConstructor.h LibJS: Reorganize spec steps for Intl.PluralRules 2022-03-15 17:30:58 +01:00
PluralRulesPrototype.cpp LibJS: Populate roundingPriority in Intl.PluralRules.resolvedOptions 2022-07-13 19:22:26 +01:00
PluralRulesPrototype.h LibJS: Implement Intl.PluralRules.prototype.selectRange 2022-07-12 00:43:34 +01:00
RelativeTimeFormat.cpp LibJS: Use Intl.PluralRules within Intl.RelativeFormat 2022-07-08 11:51:54 +02:00
RelativeTimeFormat.h LibJS: Use Intl.PluralRules within Intl.RelativeFormat 2022-07-08 11:51:54 +02:00
RelativeTimeFormatConstructor.cpp LibJS: Use Intl.PluralRules within Intl.RelativeFormat 2022-07-08 11:51:54 +02:00
RelativeTimeFormatConstructor.h LibJS: Reorganize spec steps for Intl.RelativeTimeFormat 2022-03-15 17:30:58 +01:00
RelativeTimeFormatPrototype.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
RelativeTimeFormatPrototype.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Segmenter.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
Segmenter.h LibJS: Implement the Intl CreateSegmentDataObject AO 2022-01-31 21:05:04 +02:00
SegmenterConstructor.cpp LibJS: Update to the latest ECMA-402 GetOption and move it into ECMA-262 2022-06-15 17:49:20 +01:00
SegmenterConstructor.h LibJS: Implement Intl.Segmenter.supportedLocalesOf 2022-01-30 19:47:01 +00:00
SegmenterPrototype.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
SegmenterPrototype.h LibJS: Implement Intl.Segmenter.prototype.segment 2022-01-30 19:47:01 +00:00
SegmentIterator.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
SegmentIterator.h LibJS: Implement Intl %SegmentIteratorPrototype%.next ( ) 2022-01-31 21:05:04 +02:00
SegmentIteratorPrototype.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
SegmentIteratorPrototype.h LibJS: Implement Intl %SegmentIteratorPrototype%.next ( ) 2022-01-31 21:05:04 +02:00
Segments.cpp LibJS: Remove implicit wrapping/unwrapping of completion records 2022-05-03 01:09:29 +02:00
Segments.h LibJS: Implement the Intl.Segmenter FindBoundary AO 2022-01-31 21:05:04 +02:00
SegmentsPrototype.cpp LibJS: Implement Intl %SegmentIteratorPrototype%.next ( ) 2022-01-31 21:05:04 +02:00
SegmentsPrototype.h LibJS: Implement Intl %SegmentsPrototype%.containing 2022-01-31 21:05:04 +02:00