summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-11-11 22:49:23 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-11-11 22:49:23 +0900
commit45aadd7e604c886ba7b96c69fa797a8e2937c711 (patch)
treed3a1c819b562287b8682c8f404e9467c886d3cf8
parente86ead436a3793db5c0048b888d8caee1ec84ea5 (diff)
downloadmruby-45aadd7e604c886ba7b96c69fa797a8e2937c711.tar.gz
mruby-45aadd7e604c886ba7b96c69fa797a8e2937c711.zip
HEREDOC could fail with NUL terminated lines; fix#3244
-rw-r--r--mrbgems/mruby-compiler/core/parse.y2
1 files changed, 2 insertions, 0 deletions
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)) {