From c83b67a678b13ebc7cc198ee8d0ed68225ac3e2b Mon Sep 17 00:00:00 2001 From: Kirill Simonov Date: Mon, 11 Dec 2006 19:20:29 +0000 Subject: [PATCH] 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. --- src/scanner.c | 7 +++++++ 1 file changed, 7 insertions(+) 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)) -- 2.45.1