summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Simonov <xi@resolvent.net>2006-12-11 19:20:29 +0000
committerKirill Simonov <xi@resolvent.net>2006-12-11 19:20:29 +0000
commitc83b67a678b13ebc7cc198ee8d0ed68225ac3e2b (patch)
tree0f8ef1c3760ea66babe76df9540a9ff729b57b7c
parent609cce0ef9a142e5c93b8e45b7cd495a21cb2342 (diff)
downloadlibyaml-git-c83b67a678b13ebc7cc198ee8d0ed68225ac3e2b.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.
-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))