Fix out of bounds access in complete.d when there is no paren. (#754)

This commit is contained in:
drpriver 2023-09-30 16:54:09 -07:00 committed by GitHub
parent 8a693954d3
commit dc11cf704d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -361,7 +361,12 @@ CalltipHint getCalltipHint(T)(T beforeTokens, out size_t parenIndex)
// evaluate at comma case
if (beforeTokens.isComma)
{
parenIndex = beforeTokens.goBackToOpenParen;
size_t tmp = beforeTokens.goBackToOpenParen;
if(tmp == size_t.max){
return CalltipHint.regularArguments;
}
parenIndex = tmp;
// check if we are actually a "!("
if (beforeTokens[0 .. parenIndex].isTemplateBangParen)
{