Zero length heredoc still crashed; ref Shopify/mruby-internal#81

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-12-17 15:08:05 +09:00
parent 5289b4ba11
commit b0886d5692
+6 -2
View File
@@ -3948,8 +3948,12 @@ parse_string(parser_state *p)
}
}
if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
if (c < 0) p->parsing_heredoc = NULL;
return tHEREDOC_END;
if (c < 0) {
p->parsing_heredoc = NULL;
}
else {
return tHEREDOC_END;
}
}
}
if (c < 0) {