summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxi <xi@18f92427-320e-0410-9341-c67f048884a3>2006-12-11 19:20:29 +0000
committerxi <xi@18f92427-320e-0410-9341-c67f048884a3>2006-12-11 19:20:29 +0000
commit5af9383f1063a85312b26623f0988cf1ad49b6ca (patch)
tree0f8ef1c3760ea66babe76df9540a9ff729b57b7c
parent71de943cd5a1cde17b3b17bd834e32897d8ded8e (diff)
downloadlibyaml-5af9383f1063a85312b26623f0988cf1ad49b6ca.tar.gz
Force a new line at the end of the input stream even if there are no a new line character. This fixes a nasty bug when libyaml hangs on documents like `[[[[`. Thanks ciaranm for reporting the bug.
git-svn-id: http://svn.pyyaml.org/libyaml/trunk@236 18f92427-320e-0410-9341-c67f048884a3
-rw-r--r--src/scanner.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/scanner.c b/src/scanner.c
index 1414401..b190c7e 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1324,6 +1324,13 @@ yaml_parser_fetch_stream_end(yaml_parser_t *parser)
{
yaml_token_t token;
+ /* Force new line. */
+
+ if (parser->mark.column != 0) {
+ parser->mark.column = 0;
+ parser->mark.line ++;
+ }
+
/* Reset the indentation level. */
if (!yaml_parser_unroll_indent(parser, -1))