From 885db13d09f5beb721e215942d1423f4122093e0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 19 Jan 2015 13:16:42 -0800 Subject: [PATCH] Don't infinite loop on bad keys --- src/parser.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/parser.rs b/src/parser.rs index df19ba4..8065aa8 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -220,7 +220,7 @@ impl<'a> Parser<'a> { _ => break, } } - None => {} + None => break } } Some(ret) @@ -1135,4 +1135,9 @@ trimmed in raw strings. assert!(table.lookup("f f").is_some()); assert!(table.lookup("\"").is_some()); } + + #[test] + fn invalid_bare_numeral() { + assert!(Parser::new("4").parse().is_none()); + } }