]> git.neil.brown.name Git - edlib.git/commitdiff
search: avoid infinite look with inconsistent doc:step function.
authorNeilBrown <neil@brown.name>
Mon, 22 May 2023 08:51:43 +0000 (18:51 +1000)
committerNeilBrown <neil@brown.name>
Fri, 26 May 2023 22:18:42 +0000 (08:18 +1000)
If doc:step moves back further than we expect, search_backwards can loop
forever. So check for that possibility and abort.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
lib-search.c

index f7985f12c600adcda4c3eba89428620c9c2f3af5..802538486948190a49b1ac914eceb3966136e97f 100644 (file)
@@ -55,6 +55,10 @@ Current priorities
 Bugs to be fixed
 ----------------
 
+- [ ] transparent images appear in email with horiz lines
+- [ ] Replying to w3m/html mail results in unsightly markup in reply
+- [ ] redefining doc:char but not doc:content in mail-compose causes
+      search to get confused.  What should we do?
 - [ ] why doesn't doc-to-text auto-load
 - [ ] use mimetypes.guess_type() to interpret filenames in email attachments??
 - [ ] don't allow non-text email parts to appear as text.  Maybe hex??
index 716557f6c2c4f7fc544bf606fa7ea422f556206c..ed5bb1150afa9486e8e0e7dd002f0f6c75c9eabd 100644 (file)
@@ -325,6 +325,13 @@ static int search_backward(struct pane *p safe,
                if (mark_ordered_not_same(end, ss.endmark))
                        break;
                ret = maxlen;
+               if (endmark != ss.endmark &&
+                   mark_ordered_or_same(ss.endmark, endmark))
+                       /* Didn't move forward!!  Presumably
+                        * buggy doc:step implementation.
+                        */
+                       break;
+
                mark_to_mark(endmark, ss.endmark);
                ss.endmark = m;
                mark_to_mark(start, endmark);