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

Deserializing large serialized Value::Number fails #155

Closed
niluxv opened this issue Apr 4, 2019 · 2 comments · Fixed by #157
Closed

Deserializing large serialized Value::Number fails #155

niluxv opened this issue Apr 4, 2019 · 2 comments · Fixed by #157
Assignees

Comments

@niluxv
Copy link

niluxv commented Apr 4, 2019

Expected behavior: Deserialisation of any serialized struct should succeed.

Actual behavior: When deserializing a large serialized Value::Number an error is returned.

Example:

use ron::value::Value;
let test_var = Value::Number(Number::new(10000000000000000000.0f64));
let test_ser = ron::ser::to_string(&test_var).unwrap();
let test_deser = ron::de::from_str::<Value>(&test_ser);
assert!(test_deser.is_ok()); // <-- this fails

Here test_deser is an Err<Parser(ExpectedInteger, Position { col: 1, line: 1 })>.

Version:
git rev-parse HEAD: 6e9f7dd3080bdedb88ad89700da1aad499cb303f

@torkleyy
Copy link
Contributor

torkleyy commented Apr 5, 2019

Most likely a dupe of #100

@niluxv
Copy link
Author

niluxv commented Apr 6, 2019

I don't think it's an exact duplicate of #100. I'm not trying to deserialize into an integer.
#157 fixes this. Thank you.

bors bot added a commit that referenced this issue Apr 14, 2019
157: Be smarter about integer deserialization r=torkleyy a=torkleyy

Now, `deserialize_any` will try to find the best representation possible.

This is not a very pretty implementation, but it should work well.

Fixes #100 
Fixes #155 

Co-authored-by: Thomas Schaller <torkleyy@gmail.com>
@bors bors bot closed this as completed in #157 Apr 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants