Bug 505387

Summary: htop crashes on pressing "a"
Product: [Fedora] Fedora Reporter: Tobias Mueller <fedora-bugs>
Component: htopAssignee: RafaƂ Psota <rafalzaq>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: mnowak, rafalzaq
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://sourceforge.net/tracker/index.php?func=detail&atid=651633&aid=2803527&group_id=108839
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-06-12 09:18:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch which checks for the end of an NULL terminated(!) array
none
Patch which NULL terminates all arrays none

Description Tobias Mueller 2009-06-11 18:02:45 UTC
Description of problem:
htop crashes, when I press "a"

Version-Release number of selected component (if applicable):
0.8.2

How reproducible:
start htop, press a, crashes immediately

Steps to Reproduce:
1. ./htop
2. press "a"
3.
  
Actual results:
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
(gdb) bt
#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,
x=15,
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
(gdb) quit
Expected results:
I expected htop not to crash at all.

Additional info:
Linux bigbox 2.6.27.24-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

Comment 1 Tobias Mueller 2009-06-11 18:25:13 UTC
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).

Comment 2 Tobias Mueller 2009-06-11 18:26:35 UTC
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.

Comment 3 Tobias Mueller 2009-06-11 18:33:51 UTC
Created attachment 347449 [details]
Patch which NULL terminates all arrays

This patch NULL terminates all arrays, I've found.

Comment 4 Michal Nowak 2009-06-12 09:18:21 UTC

*** This bug has been marked as a duplicate of bug 504795 ***