Skip to content

Commit

Permalink
Fix out of bounds access in complete.d when there is no paren. (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
drpriver authored Sep 30, 2023
1 parent 8a69395 commit dc11cf7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dcd/server/autocomplete/complete.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit dc11cf7

Please sign in to comment.