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

Invalid JSON values are accepted: numbers with trailing dot but only if greater than u64::MAX #953

Closed
tmpolaczyk opened this issue Nov 18, 2022 · 1 comment · Fixed by #956

Comments

@tmpolaczyk
Copy link

According to JSON spec, both of these should be errors:

fn main() {
    let x1: Result<serde_json::Value, _> = serde_json::from_str("18446744073709551615.");
    assert!(x1.is_err());
    let x2: Result<serde_json::Value, _> = serde_json::from_str("18446744073709551616.");
    assert!(x2.is_err());
}

Playground

But this is the output, as of serde_json 1.0.88:

thread 'main' panicked at 'assertion failed: x2.is_err()', src/main.rs:5:5
@dtolnay
Copy link
Member

dtolnay commented Nov 22, 2022

Thanks — good catch. I've published a fix in 1.0.89.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants