From 45aadd7e604c886ba7b96c69fa797a8e2937c711 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 11 Nov 2016 22:49:23 +0900 Subject: HEREDOC could fail with NUL terminated lines; fix#3244 --- mrbgems/mruby-compiler/core/parse.y | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 426c262fb..76fb398e2 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -3907,6 +3907,8 @@ parse_string(parser_state *p) int end = (intptr_t)p->lex_strterm->cdr->cdr->cdr; parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL; + if (beg == 0) beg = -3; /* should never happen */ + if (end == 0) end = -3; newtok(p); while ((c = nextc(p)) != end || nest_level != 0) { if (hinf && (c == '\n' || c < 0)) { -- cgit v1.2.3