summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-10-15 18:58:49 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-10-15 18:58:49 (GMT)
commited64ae0c1ce560ecea8dddefe9feb8d6f527e676 (patch)
treec71b2f4c7a592b8663181be98acd798947478356 /generic/tkText.c
parentf7b70960c710c207bfcb64456cab0aa0e2dcbe1b (diff)
downloadtk-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.c3
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