]> git.neil.brown.name Git - edlib.git/commitdiff
lib-renderline: avoid possible infinite loop.
authorNeilBrown <neil@brown.name>
Tue, 8 Jun 2021 23:28:30 +0000 (09:28 +1000)
committerNeilBrown <neil@brown.name>
Fri, 11 Jun 2021 11:16:38 +0000 (21:16 +1000)
If window is tiny and measurement doesn't work, we can get into infinite
loop, not drawing anything.
Guard against this by testing that lineheight is positive.

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

index 08d0677b0324da590b0fae4283916c2fd21288c5..fd80c4e195dcc3ced0a2a8e1eb858ee9f708769f 100644 (file)
@@ -28,7 +28,7 @@ Current priorities
 Bugs to be fixed
 ----------------
 
-- [ ] lib-renderline in a 1x1 pane spins.  Happens if I 'elc' while cursor
+- [X] lib-renderline in a 1x1 pane spins.  Happens if I 'elc' while cursor
       is in a search popup.
 - [X] notmuch compose adds 'Re:' if it already exists
 - [ ] x11selection doesn't work properly on second ncurses display
@@ -37,7 +37,7 @@ Bugs to be fixed
 - [X] introduce per-pane timestamp so code can easily tell if it has run too long
 - [ ] teach input to allow a repeat command to be registered so that e.g.
       search/replace and do a bit of work, then ask to be called again.
-      input can cancel this on suitable input.
+      input pboard_waican cancel this on suitable input.
 - [X] handle reply-to header when replying to emails
 - [X] file names created for attachments need spaces etc translated
       for scp to work well ... at least when ncurses wants to use scp.
index 568ad431b2cfbf42e8cabd74f0a4a519da107317..6a7a43f683d15bad162ac5ed615c476e3f5dba23 100644 (file)
@@ -524,6 +524,9 @@ DEF_CMD(renderline)
        update_line_height(p, focus, &line_height, &ascent, &twidth, &center,
                           line, scale);
 
+       if (line_height <= 0)
+               return Einval;
+
        if (!wrap)
                x -= shift_left;
        else