mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Fix crash when parsing {x:
(#865)
This commit is contained in:

committed by
GitHub

parent
d9c35b6079
commit
f05b2577ad
@@ -155,7 +155,7 @@ inline const RegEx& PlainScalar() {
|
|||||||
inline const RegEx& PlainScalarInFlow() {
|
inline const RegEx& PlainScalarInFlow() {
|
||||||
static const RegEx e =
|
static const RegEx e =
|
||||||
!(BlankOrBreak() | RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) |
|
!(BlankOrBreak() | RegEx("?,[]{}#&*!|>\'\"%@`", REGEX_OR) |
|
||||||
(RegEx("-:", REGEX_OR) + Blank()));
|
(RegEx("-:", REGEX_OR) + (Blank() | RegEx())));
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
inline const RegEx& EndScalar() {
|
inline const RegEx& EndScalar() {
|
||||||
|
@@ -1127,5 +1127,10 @@ TEST(NodeSpecTest, Ex8_22_BlockCollectionNodes) {
|
|||||||
EXPECT_EQ(1, doc["mapping"].size());
|
EXPECT_EQ(1, doc["mapping"].size());
|
||||||
EXPECT_EQ("bar", doc["mapping"]["foo"].as<std::string>());
|
EXPECT_EQ("bar", doc["mapping"]["foo"].as<std::string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(NodeSpecTest, FlowMapNotClosed) {
|
||||||
|
EXPECT_THROW_PARSER_EXCEPTION(Load("{x:"), ErrorMsg::UNKNOWN_TOKEN);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user