From 3322bcd086399a658253e119323f4b4c44aa91ff Mon Sep 17 00:00:00 2001 From: Alan Du Date: Wed, 31 May 2017 00:07:15 +0100 Subject: Error when parsing numbers outside of f64's range --- src/de.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/de.rs b/src/de.rs index bd4ead0..d5af272 100644 --- a/src/de.rs +++ b/src/de.rs @@ -893,6 +893,12 @@ impl<'a> Deserializer<'a> { } number.parse().map_err(|_e| { self.error(start, ErrorKind::NumberInvalid) + }).and_then(|n: f64| { + if n.is_finite() { + Ok(n) + } else { + Err(self.error(start, ErrorKind::NumberInvalid)) + } }) } -- cgit v1.2.3