Skip to content
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

Overflows are ignored in some cases when checked-converting from Int128 to SignedInteger #99489

Closed
skyoxZ opened this issue Mar 10, 2024 · 0 comments · Fixed by #100342
Closed

Comments

@skyoxZ
Copy link
Contributor

skyoxZ commented Mar 10, 2024

Description

public static explicit operator checked long(Int128 value)
{
if (~value._upper == 0)
{
long lower = (long)value._lower;
return lower;
}

Overflows are ignored when lower >= 0.

Search if (~value._upper == 0) in that file to find more.

Reproduction Steps

Int128 a = new(ulong.MaxValue, 42);
var b = checked((long)a);
Console.WriteLine(b);

Expected behavior

OverflowException

Actual behavior

42

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 10, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 10, 2024
@vcsjones vcsjones added area-System.Numerics and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 10, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Apr 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants