]> git.lyx.org Git - features.git/commitdiff
Findadv: Do not use out of range index into a string
authorKornel Benko <kornel@lyx.org>
Tue, 26 May 2020 13:58:23 +0000 (15:58 +0200)
committerKornel Benko <kornel@lyx.org>
Tue, 26 May 2020 13:58:23 +0000 (15:58 +0200)
Thanks Scott. Crashing if using _GLIBCXX_DEBUG preprocessor setting

src/lyxfind.cpp

index f98f525cbe7f072404e5301771b1aaeca37dcd11..ab5d98580e576ab9b5bea2500db1076019fa855d 100644 (file)
@@ -2432,7 +2432,7 @@ int LatexInfo::dispatch(ostringstream &os, int previousStart, KeyInfo &actual)
       int val = actual._tokenstart;
       for (count = 0; count < actual._tokenstart;) {
         val = interval_.previousNotIgnored(val-1);
-        if (interval_.par[val] != ' ')
+        if (val < 0 || interval_.par[val] != ' ')
           break;
         else {
           count = actual._tokenstart - val;