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
commita5dab4db21662e6be49cb91a55d2425071fa74fe (patch)
tree0f8ef1c3760ea66babe76df9540a9ff729b57b7c
parent2ef0340f88d9e32e564cc40a77346988b2127834 (diff)
downloadlibyaml-git-a5dab4db21662e6be49cb91a55d2425071fa74fe.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))