Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Aug 27, 2021

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.

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
Copy link

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.

@lambdageek lambdageek added the Servicing-consider Issue for next servicing release review label Aug 27, 2021
@lambdageek lambdageek added this to the 6.0.0 milestone Aug 27, 2021
@ghost
Copy link

ghost commented Aug 27, 2021

Tagging subscribers to this area:
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: github-actions[bot]
Assignees: -
Labels:

Servicing-consider, area-VM-meta-mono

Milestone: 6.0.0

@ghost
Copy link

ghost commented Aug 27, 2021

Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: github-actions[bot]
Assignees: -
Labels:

Servicing-consider, area-Codegen-Interpreter-mono

Milestone: 6.0.0

@marek-safar marek-safar removed the Servicing-consider Issue for next servicing release review label Aug 27, 2021
@marek-safar marek-safar merged commit 6289d9e into release/6.0 Aug 28, 2021
@marek-safar marek-safar deleted the backport/pr-58114-to-release/6.0 branch August 28, 2021 08:07
@ghost ghost locked as resolved and limited conversation to collaborators Sep 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants