Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Deserializing huge numbers into infinity #181

Closed
alanhdu opened this issue May 30, 2017 · 1 comment
Closed

Deserializing huge numbers into infinity #181

alanhdu opened this issue May 30, 2017 · 1 comment

Comments

@alanhdu
Copy link
Contributor

alanhdu commented May 30, 2017

toml returns a NumberInvalid error when to deserialize inf, but happily serialize numbers like 99e999 into inf:

extern crate toml;
fn main() {
    let s = "key = 99e9999";
    let data: toml::Value = toml::from_str(s).unwrap();  // fails with "key = inf"
    println!("{}", toml::to_string(&data).unwrap());
}

outputs key = inf.

Given that inf is already explicitly disallowed, I feel like toml should also return a NumberInvalid error here instead of silently deserializing things into inf.

Found with rust-fuzz/targets#72

@alexcrichton
Copy link
Collaborator

Fixed by #183

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

No branches or pull requests

2 participants