Bug 505387 - htop crashes on pressing "a"
htop crashes on pressing "a"
Status: CLOSED DUPLICATE of bug 504795
Product: Fedora
Classification: Fedora
Component: htop (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Rafał Psota
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-06-11 14:02 EDT by Tobias Mueller
Modified: 2009-06-12 05:18 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-06-12 05:18:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch which checks for the end of an NULL terminated(!) array (1.48 KB, patch)
2009-06-11 14:26 EDT, Tobias Mueller
no flags Details | Diff
Patch which NULL terminates all arrays (3.24 KB, patch)
2009-06-11 14:33 EDT, Tobias Mueller
no flags Details | Diff

  None (edit)
Description Tobias Mueller 2009-06-11 14:02:45 EDT
Description of problem:
htop crashes, when I press "a"

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

How reproducible:
start htop, press a, crashes immediately

Steps to Reproduce:
1. ./htop
2. press "a"
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,
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 #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 14:25:13 EDT
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 14:26:35 EDT
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 14:33:51 EDT
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 05:18:21 EDT

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

Note You need to log in before you can comment on or make changes to this bug.