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
parent d53a991b07
commit b4168c9b68
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;
}