parse.y: empty here-doc delimiter caused infinite loop; fix #5676

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-03-25 07:45:06 +09:00
committed by mimaki
parent c627e3b2ab
commit eaadc5e79f
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -4856,7 +4856,7 @@ parse_string(parser_state *p)
--len;
}
}
if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
if (hinf->term_len > 0 && len-1 == hinf->term_len && strncmp(s, hinf->term, len-1) == 0) {
heredoc_remove_indent(p, hinf);
return tHEREDOC_END;
}
+1 -1
View File
@@ -11087,7 +11087,7 @@ parse_string(parser_state *p)
--len;
}
}
if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
if (hinf->term_len > 0 && len-1 == hinf->term_len && strncmp(s, hinf->term, len-1) == 0) {
heredoc_remove_indent(p, hinf);
return tHEREDOC_END;
}