Fix float with invalid suffix.

This commit is contained in:
Eric Huss 2019-04-05 13:51:28 -07:00
parent 743cfcef05
commit 816b457c84
3 changed files with 5 additions and 0 deletions

View file

@ -1396,6 +1396,8 @@ impl<'a> Deserializer<'a> {
return Err(self.error(start, ErrorKind::NumberInvalid)); return Err(self.error(start, ErrorKind::NumberInvalid));
} }
exponent = Some(a); exponent = Some(a);
} else if !suffix.is_empty() {
return Err(self.error(start, ErrorKind::NumberInvalid));
} }
let mut number = integral let mut number = integral

View file

@ -38,6 +38,8 @@ test!(empty_table,
include_str!("invalid/empty-table.toml")); include_str!("invalid/empty-table.toml"));
test!(float_no_leading_zero, test!(float_no_leading_zero,
include_str!("invalid/float-no-leading-zero.toml")); include_str!("invalid/float-no-leading-zero.toml"));
test!(float_no_suffix,
include_str!("invalid/float-no-suffix.toml"));
test!(float_no_trailing_digits, test!(float_no_trailing_digits,
include_str!("invalid/float-no-trailing-digits.toml")); include_str!("invalid/float-no-trailing-digits.toml"));
test!(key_after_array, test!(key_after_array,

View file

@ -0,0 +1 @@
a = 1.2f