Red Hat Bugzilla – Bug 505387
htop crashes on pressing "a"
Last modified: 2009-06-12 05:18:21 EDT
Description of problem:
htop crashes, when I press "a"
Version-Release number of selected component (if applicable):
start htop, press a, crashes immediately
Steps to Reproduce:
2. press "a"
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:37
37 0: cmpb $0x0,(%rax) /* is byte NUL? */
Current language: auto; currently asm
#0 strlen () at ../sysdeps/x86_64/strlen.S:37
#1 0x0000003fb4480ba6 in __strdup (
s=0x4a314554 <Address 0x4a314554 out of bounds>) at strdup.c:42
#2 0x00000000004055f3 in FunctionBar_new (functions=0x7fffffffe060,
keys=0x7fffffffa5c0, events=0x7fffffffa5e0) at FunctionBar.c:57
#3 0x00000000004060a3 in pickFromVector (panel=0x82cd70, list=0x83d660,
y=6, keyLabels=0x7fffffffe060, prevBar=0x82da10) at htop.c:198
#4 0x00000000004072f7 in main (argc=<value optimized out>,
argv=<value optimized out>) at htop.c:660
(gdb) t a a bt full
I expected htop not to crash at all.
Linux bigbox 184.108.40.206-170.2.68.fc10.x86_64 #1 SMP Wed May 20 22:47:23 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
Upstream bugreport: http://sourceforge.net/tracker/index.php?func=detail&atid=651633&aid=2803527&group_id=108839
seems to be the same issue as bug 504795. I cooked up a patch for my issue, I smell other bugs, because *every* functions array has to be NULL terminated (with the solution I propose).
Created attachment 347448 [details]
Patch which checks for the end of an NULL terminated(!) array
This fixes the issue for me. If you want to port this patch to fix other issues, look out for the creation of a char* array which is passed to FunctionBar_new. The array has to be NULL terminated.
Created attachment 347449 [details]
Patch which NULL terminates all arrays
This patch NULL terminates all arrays, I've found.
*** This bug has been marked as a duplicate of bug 504795 ***