HEREDOC could fail with NUL terminated lines; fix#3244

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-11 22:49:23 +09:00
parent e86ead436a
commit 45aadd7e60
+2
View File
@@ -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)) {