Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
f05b2577
Unverified
Commit
f05b2577
authored
May 23, 2020
by
Raúl Gutiérrez Segalés
Committed by
GitHub
May 23, 2020
Browse files
Fix crash when parsing `{x:` (#865)
parent
d9c35b60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
src/exp.h
src/exp.h
+1
-1
test/integration/node_spec_test.cpp
test/integration/node_spec_test.cpp
+5
-0
No files found.
src/exp.h
View file @
f05b2577
...
@@ -155,7 +155,7 @@ inline const RegEx& PlainScalar() {
...
@@ -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
()
{
...
...
test/integration/node_spec_test.cpp
View file @
f05b2577
...
@@ -1127,5 +1127,10 @@ TEST(NodeSpecTest, Ex8_22_BlockCollectionNodes) {
...
@@ -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
);
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment