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

Cast numbers in "uint oob" test error messages to avoid overflows #514

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

anthonyfok
Copy link
Contributor

Description of changes:

For "uint oob" tests in TestAsInt32 and TestAsFloat64 in encoding/cbor/coerce_test.go, cast the number to Uint in the error message just as the number is cast in the test itself, so as to avoid overflows when tested on 32-bit architectures.

Fixes cannot use maxv + 1 (untyped int constant 2147483648) as int value in argument to fmt.Sprintf (overflows) in TestAsInt32 and cannot use maxv + 1 (untyped int constant 18014398509481985) as int value in argument to fmt.Sprintf (overflows) in TestAsFloat64 on 32-bit platforms.

Detected by Debian CI running on 386; see https://ci.debian.net/packages/g/golang-github-aws-smithy-go/testing/i386/47149094/#L1260

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

For "uint oob" tests in TestAsInt32 and TestAsFloat64 in
encoding/cbor/coerce_test.go, cast the number to Uint in the error
message just as the number is cast in the test itself, so
as to avoid overflows when tested on 32-bit architectures.

Fixes "cannot use maxv + 1 (untyped int constant 2147483648)
as int value in argument to fmt.Sprintf (overflows)" in TestAsInt32
and "cannot use maxv + 1 (untyped int constant 18014398509481985)
as int value in argument to fmt.Sprintf (overflows)" in TestAsFloat64

Detected by Debian CI running on 386; see
https://ci.debian.net/packages/g/golang-github-aws-smithy-go/testing/i386/47149094/#L1260
@anthonyfok anthonyfok requested review from a team as code owners June 1, 2024 13:38
@lucix-aws lucix-aws merged commit dd523d1 into aws:main Jun 27, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants