Skip to content

Commit

Permalink
HEREDOC could fail with NUL terminated lines; fix#3244
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Nov 11, 2016
1 parent e86ead4 commit 45aadd7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mrbgems/mruby-compiler/core/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 45aadd7

Please sign in to comment.