diff options
author | fvogel <fvogelnew1@free.fr> | 2018-10-15 18:58:49 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2018-10-15 18:58:49 (GMT) |
commit | ed64ae0c1ce560ecea8dddefe9feb8d6f527e676 (patch) | |
tree | c71b2f4c7a592b8663181be98acd798947478356 /generic/tkText.c | |
parent | f7b70960c710c207bfcb64456cab0aa0e2dcbe1b (diff) | |
download | tk-ed64ae0c1ce560ecea8dddefe9feb8d6f527e676.zip tk-ed64ae0c1ce560ecea8dddefe9feb8d6f527e676.tar.gz tk-ed64ae0c1ce560ecea8dddefe9feb8d6f527e676.tar.bz2 |
Third fix proposal for [4b555aca34]: text search -all hangs and eats all memory. (And fix test text-22.229)
Diffstat (limited to 'generic/tkText.c')
-rw-r--r-- | generic/tkText.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index e49693e..7dfd048 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -6090,7 +6090,8 @@ SearchCore( alreadySearchOffset -= matchLength; } } else { - firstOffset = p - startOfLine + matchLength; + firstOffset = (matchLength == 0) ? p - startOfLine + 1 + : p - startOfLine + matchLength; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find |