sfeed_curses: fix crash with lazy loading feeds and searching - sfeed - RSS and Atom parser
HTML git clone git://git.codemadness.org/sfeed
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 147e779c73ee71228a55ec423b8a2f8bd658b2dc
DIR parent d90b3e86029ea0c6d3f1e41055cc6efd8c974f49
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 27 Sep 2026 13:35:29 +0200
sfeed_curses: fix crash with lazy loading feeds and searching
If lazy loading a feed from disk is used (SFEED_LAZYLOAD=1), but the (large)
feed data was truncated and pane_row_get would return NULL then sfeed_curses
can crash when searching foward or backward.
To reproduce:
cp large truncate
SFEED_LAZYLOAD=1 "$sfeed" ./truncate
Outside sfeed truncate the feed
>truncate
Then search forward or backward using / or ?
Reported by jb19357, thanks!
Diffstat:
M sfeed_curses.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
DIR diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -2226,7 +2226,8 @@ nextpage:
if (ch == '/' || ch == 'n') {
/* forward */
for (pos = p->pos + 1; pos < p->nrows; pos++) {
- if (pane_row_match(p, pane_row_get(p, pos), search)) {
+ if ((row = pane_row_get(p, pos)) &&
+ pane_row_match(p, row, search)) {
pane_setpos(p, pos);
break;
}
@@ -2234,7 +2235,8 @@ nextpage:
} else {
/* backward */
for (pos = p->pos - 1; pos >= 0; pos--) {
- if (pane_row_match(p, pane_row_get(p, pos), search)) {
+ if ((row = pane_row_get(p, pos)) &&
+ pane_row_match(p, row, search)) {
pane_setpos(p, pos);
break;
}