-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Draft] Limit length of System.Runtime.BigInteger to int.MaxValue-32 bits #84901
Conversation
- Limit `BigInteger.MaxLength` to `int.MaxValue/32` uints. This is equal to limit length in bits to `int.MaxValue-32 bits` - Fix ctor `BigInteger(ReadOnlySpan<byte>, bool, bool)` to check MaxLength limit - Fix private ctor `BigInteger(ReadOnlySpan<uint>, bool)` to check `MaxLength` limit after trying to conserve space, not before - Fix private ctor `BigInteger(Span<uint>)` to check MaxLength limit after trying to conserve space, not before - Fix obsolete comment in AssertValid() - Fix test `LargeNegativeBigIntegerShiftTest` to respect new limit. fix dotnet#84670
Tagging subscribers to this area: @dotnet/area-system-numerics Issue DetailsSee discussion in #84670
fix #84670
|
The overflow guard in |
Thank you for point that! I'll check it. |
nit: Keep the braces please Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Thank you for your help, there is absolutely no rush from our side. I am going to apply "need author action" label so this PR is not listed on our internal list of PRs awaiting for review. |
This pull request has been automatically marked |
I still plan to complete this. |
This pull request has been automatically marked |
This pull request will now be closed since it had been marked |
See discussion in #84670
BigInteger.MaxLength
toint.MaxValue/32
uints. This is equal to limit length in bits toint.MaxValue-32 bits
BigInteger(ReadOnlySpan<byte>, bool, bool)
to check MaxLength limitBigInteger(ReadOnlySpan<uint>, bool)
to checkMaxLength
limit after trying to conserve space, not beforeBigInteger(Span<uint>)
to check MaxLength limit after trying to conserve space, not beforeLargeNegativeBigIntegerShiftTest
to respect new limit.fix #84670