-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[release/6.0] [mono] Fix a few corner case overflow operations #58265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
|
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. |
|
Tagging subscribers to this area: Issue DetailsBackport of #58114 to release/6.0 /cc @lambdageek @BrzVlad 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.
|
|
Tagging subscribers to this area: @BrzVlad Issue DetailsBackport of #58114 to release/6.0 /cc @lambdageek @BrzVlad 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.