Unverified Commit f05b2577 authored by Raúl Gutiérrez Segalés's avatar Raúl Gutiérrez Segalés Committed by GitHub
Browse files

Fix crash when parsing `{x:` (#865)

parent d9c35b60
......@@ -155,7 +155,7 @@ inline const RegEx& PlainScalar() {
inline const RegEx& PlainScalarInFlow() {
static const RegEx e =
!(BlankOrBreak() | RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) |
(RegEx("-:", REGEX_OR) + Blank()));
(RegEx("-:", REGEX_OR) + (Blank() | RegEx())));
return e;
}
inline const RegEx& EndScalar() {
......
......@@ -1127,5 +1127,10 @@ TEST(NodeSpecTest, Ex8_22_BlockCollectionNodes) {
EXPECT_EQ(1, doc["mapping"].size());
EXPECT_EQ("bar", doc["mapping"]["foo"].as<std::string>());
}
TEST(NodeSpecTest, FlowMapNotClosed) {
EXPECT_THROW_PARSER_EXCEPTION(Load("{x:"), ErrorMsg::UNKNOWN_TOKEN);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment