From 3f322faf624c505a044ceaf7aa33ae02e696ffdd Mon Sep 17 00:00:00 2001 From: SnipUndercover Date: Sun, 17 Apr 2022 00:02:08 +0200 Subject: [PATCH] Fix a crash in UDL Fix infinite loop while lexing UDL multi-part keyword in prefix mode. Fix #11434, close #11543 --- lexilla/lexers/LexUser.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lexilla/lexers/LexUser.cxx b/lexilla/lexers/LexUser.cxx index 2ee1b3f5b..adca1e202 100644 --- a/lexilla/lexers/LexUser.cxx +++ b/lexilla/lexers/LexUser.cxx @@ -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)) {