tompickering / mantra

Man-page bookmarker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault when making screen too narrow

tompickering opened this issue · comments

Narrowing the screen eventually triggers a segfault. This does not appear to be replicable when run within gdb, but seems likely to be down to layout code (probably formatting lines in the 'pages' window).

Reproduced this one and got a stack trace,

#0  0x0000000000405cfa in string_clean_buffer (buf=0x2251090 ".\214\"\002", 
    src=0x2108fe0 "listens on a socket for Valgrind commentary\n", len=1)
    at win/win.c:226
#1  0x00000000004045b5 in win_page_show (win=0x22440e0) at win/pages.c:72
#2  0x0000000000404801 in draw_win_pages () at win/pages.c:100
#3  0x0000000000405bf0 in win_draw_all () at win/win.c:202
#4  0x0000000000402542 in draw_windows (r=49, c=11) at draw.c:46
#5  0x000000000040256e in draw_screen () at draw.c:52
#6  0x0000000000402329 in main (argc=1, argv=0x7ffdf89c7078) at mantra.c:85

The line of code that looks suspicious and is obviously mentioned by the stack trace is this,

buf[len-3] = buf[len-2] = buf[len-1] = '.';