Skip to content

Commit

Permalink
Fix a crash in UDL
Browse files Browse the repository at this point in the history
Fix infinite loop while lexing UDL multi-part keyword in prefix mode.

Fix notepad-plus-plus#11434, close notepad-plus-plus#11543
  • Loading branch information
SnipUndercover authored and donho committed May 1, 2022
1 parent b57254a commit 3f322fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lexilla/lexers/LexUser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,10 @@ static bool isInListBackward(WordList & list, StyleContext & sc, bool specialMod
}

// skip next "word" (if next word is not found, go back to end of multi-part keyword)
// it is not necessary to check EOF position here, because sc.GetRelative returns ' ' beyond EOF
// it is not necessary to check EOF position here, because sc.GetRelative returns '\0' beyond EOF by default
// return ' ' on EOF instead to not loop indefinitely
bool nextWordFound = false;
while (!isWhiteSpace2(sc.GetRelative(indexb + offset), nlCountTemp, wsChar, sc.GetRelative(offset + indexb + 1)))
while (!isWhiteSpace2(sc.GetRelative(indexb + offset, ' '), nlCountTemp, wsChar, sc.GetRelative(offset + indexb + 1, ' ')))
{
if (isInListForward2(fwEndVectors, FW_VECTORS_TOTAL, sc, ignoreCase, indexb + offset))
{
Expand Down

0 comments on commit 3f322fa

Please sign in to comment.