commit b83bd16d8ac921df3d92641449e66f6cc1729e97
Author: Stephan Witt <[email protected]>
Date: Sun Dec 14 16:15:38 2025 +0100
#13261 add check for broken position and length of spell check ranges
---
src/Paragraph.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 3a7600035c..83446b0ccb 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -5278,13 +5278,21 @@ void Paragraph::Private::markMisspelledWords(
pos_type numskipped = 0;
SkipPositionsIterator it = skips.begin();
SkipPositionsIterator et = skips.end();
+ int wsize = word.size();
for (int index = 0; index < nerrors; ++index) {
pos_type wstart;
int wlen = 0;
speller->misspelledWord(index, wstart, wlen);
/// should not happen if speller supports range checks
- if (!wlen)
+ if (0 == wlen)
continue;
+ if (wstart + wlen > wsize) {
+ LYXERR(Debug::GUI, "OUTSIDE of word: \"" <<
+ word << "\" [" <<
+ wstart << ".." << (wstart + wlen) << "]" <<
+ " word size: " << wsize);
+ break;
+ }
WordLangTuple const candidate(word.substr(wstart, wlen), lang);
wstart += first + numskipped;
if (snext < wstart) {
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs