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

parent 5289b4ba
...@@ -3948,10 +3948,14 @@ parse_string(parser_state *p) ...@@ -3948,10 +3948,14 @@ parse_string(parser_state *p)
} }
} }
if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) { if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
if (c < 0) p->parsing_heredoc = NULL; if (c < 0) {
p->parsing_heredoc = NULL;
}
else {
return tHEREDOC_END; return tHEREDOC_END;
} }
} }
}
if (c < 0) { if (c < 0) {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "can't find heredoc delimiter \"%s\" anywhere before EOF", hinf->term); snprintf(buf, sizeof(buf), "can't find heredoc delimiter \"%s\" anywhere before EOF", hinf->term);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment