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

Do not set value on float overflow #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

huww98
Copy link
Contributor

@huww98 huww98 commented Feb 11, 2025

This is consistent with int overflow and json v1

This is consistent with int overflow and json v1
@dsnet
Copy link
Collaborator

dsnet commented Feb 11, 2025

Hi, thanks for the contribution. We're still doing widescale regression testing and we may or may not do this. v1 is already inconsistent with itself, so is not necessarily the best model to follow.

@huww98
Copy link
Contributor Author

huww98 commented Feb 12, 2025

Thanks for your reply. My largest concern is exposing the math.MaxFloat64 to user (golang/go#63397 (comment)), this can be confusing, or even incorrect in some cases. And apart from v1, this is also consistent with v2 int overflow behavior:

json/arshal_test.go

Lines 5103 to 5107 in 7564cc5

name: jsontest.Name("Ints/Int64/MaxOverflow"),
inBuf: `9223372036854775808`,
inVal: addr(int64(-1)),
want: addr(int64(-1)),
wantErr: EU(strconv.ErrRange).withVal(`9223372036854775808`).withType('0', T[int64]()),

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