Uh oh!
There was an error while loading. Please reload this page.
[release/6.0] [mono] Fix a few corner case overflow operations - #58265
Conversation
mono_is_power_of_two is meant to be used only on unsigned numbers. In some cases we pass a signed value instead. This is typically not a problem because negative numbers are not detected as a power of two, except for the special number -2147483648, which is coded as 0x80000000, therefore a power of two.
Floating point numbers are truncated towards 0 when converted to integers, therefore we need to increase the overflow range. For example, (int8)-128.5 = -128, without overflows, even if -128.5 is smaller than the minimum integer. Stop relying on undefined behavior by casting from floating point to integral without range checks.
Later we should reuse these methods also with jit
ghost
commented
Aug 27, 2021
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
ghost
commented
Aug 27, 2021
Tagging subscribers to this area: Issue DetailsBackport of #58114 to release/6.0 Customer ImpactFloating point to integer conversions did not detect some out of range values correctly when using the Mono interpreter. TestingCI RiskLow - trading a silent incorrect answer for a runtime exception.
|
ghost
commented
Aug 27, 2021
Tagging subscribers to this area: @BrzVlad Issue DetailsBackport of #58114 to release/6.0 Customer ImpactFloating point to integer conversions did not detect some out of range values correctly when using the Mono interpreter. TestingCI RiskLow - trading a silent incorrect answer for a runtime exception.
|
Backport of #58114 to release/6.0
/cc @lambdageek@BrzVlad
Customer Impact
Floating point to integer conversions did not detect some out of range values correctly when using the Mono interpreter.
Testing
CI
Risk
Low - trading a silent incorrect answer for a runtime exception.