Merge pull request #299 from ehuss/fix-float-suffix

Fix float with invalid suffix.
This commit is contained in:
Alex Crichton 2019-04-08 09:09:07 -05:00 committed by GitHub
commit b147fe3682
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