From b548b29b2bc7998508c0e94309a396070bcdde41 Mon Sep 17 00:00:00 2001 From: yaisog Date: Sat, 4 Mar 2023 14:37:16 +0100 Subject: [PATCH] Prevent infinite loop for single-word texts (#7327) --- core/modules/filters/strings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/filters/strings.js b/core/modules/filters/strings.js index ddef2eed9..4a3c7c170 100644 --- a/core/modules/filters/strings.js +++ b/core/modules/filters/strings.js @@ -112,7 +112,7 @@ function diffPartsToChars(text1,text2,mode) { if(mode === "words") { regexpResult = searchRegexp.exec(text); lineEnd = searchRegexp.lastIndex; - if(lineEnd === null) { + if(regexpResult === null) { lineEnd = text.length; } lineEnd = --lineEnd;