Package: htop
Version: 0.6.6+svn20070915-1
Severity: important
Tags: patch

Hi,

the limit of line length when parsing configuration file is currently
512, which is too low when it comes to 128 or 256 CPUs. Please either
raise the limit to e.g. 4k, which should be sufficient to handle a bunch
of cases, or think of using a loop reallocating memory as needed, which
would be even smarter.

I'm attaching gdb output as well as the tiny patch we're using.

Cheers,

--
Cyril Brulebois

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages htop depends on:
ii  libc6                     2.7-9          GNU C Library: Shared libraries
ii  libncurses5               5.6+20080203-1 Shared libraries for
terminal hand

htop recommends no packages.

-- no debconf information


-- 
Cyril Brulebois
--- a/Settings.c
+++ b/Settings.c
@@ -96,7 +96,7 @@
    if (fd == NULL) {
       return false;
    }
-   const int maxLine = 512;
+   const int maxLine = 4096;
    char buffer[maxLine];
    bool readMeters = false;
    while (!feof(fd)) {

Starting program: /usr/bin/htop

Program received signal SIGSEGV, Segmentation fault.
0x00000000004099b0 in Meter_setMode (this=0x0, modeIndex=1) at Meter.c:215
215        if (modeIndex > 0 && modeIndex == this->mode)
#0  0x00000000004099b0 in Meter_setMode (this=0x0, modeIndex=1) at Meter.c:215
#1  0x00000000004061cd in Header_setMode (this=0x61a980, i=63, 
mode=BAR_METERMODE, side=LEFT_HEADER) at Header.c:77
#2  0x000000000040f823 in Settings_readMeterModes (this=0x61aaf0,
    line=0x61b700 "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \n", 
side=LEFT_HEADER) at Settings.c:86
#3  0x000000000040fdac in Settings_read (this=0x61aaf0, fileName=0x61ab20 
"/home/cyril/.htoprc") at Settings.c:157
#4  0x000000000040f690 in Settings_new (pl=0x61a100, header=0x61a980) at 
Settings.c:47
#5  0x0000000000407bfc in main (argc=1, argv=0x7fff56c2d2a8) at htop.c:270
The program is running.  Exit anyway? (y or n) Starting program: /usr/bin/htop

Program received signal SIGSEGV, Segmentation fault.
0x00000000004099b0 in Meter_setMode (this=0x0, modeIndex=1) at Meter.c:215
215        if (modeIndex > 0 && modeIndex == this->mode)
#0  0x00000000004099b0 in Meter_setMode (this=0x0, modeIndex=1) at Meter.c:215
#1  0x00000000004061cd in Header_setMode (this=0x61a980, i=63, 
mode=BAR_METERMODE, side=LEFT_HEADER) at Header.c:77
#2  0x000000000040f823 in Settings_readMeterModes (this=0x61aaf0,
    line=0x61b700 "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \n", 
side=LEFT_HEADER) at Settings.c:86
#3  0x000000000040fdac in Settings_read (this=0x61aaf0, fileName=0x61ab20 
"/home/cyril/.htoprc") at Settings.c:157
#4  0x000000000040f690 in Settings_new (pl=0x61a100, header=0x61a980) at 
Settings.c:47
#5  0x0000000000407bfc in main (argc=1, argv=0x7fffee921f98) at htop.c:270
#0  0x00000000004099b0 in Meter_setMode (this=0x0, modeIndex=1) at Meter.c:215
No locals.
#1  0x00000000004061cd in Header_setMode (this=0x61a980, i=63, 
mode=BAR_METERMODE, side=LEFT_HEADER) at Header.c:77
        meters = (Vector *) 0x61a9b0
        meter = (Meter *) 0x0
#2  0x000000000040f823 in Settings_readMeterModes (this=0x61aaf0,
    line=0x61b700 "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \n", 
side=LEFT_HEADER) at Settings.c:86
        mode = 1
        trim = 0x61b790 "P¸a"
        ids = (char **) 0x61ec90
        i = 63
#3  0x000000000040fdac in Settings_read (this=0x61aaf0, fileName=0x61ab20 
"/home/cyril/.htoprc") at Settings.c:157
        option = (char **) 0x61b6a0
        fd = (FILE *) 0x61ab40
        maxLine = 512
        buffer = 0x7fffee91cd60 "left_meter_modes=1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 1 1 1 1 1 1 1 1 1 1 1 \n"
        readMeters = true
#4  0x000000000040f690 in Settings_new (pl=0x61a100, header=0x61a980) at 
Settings.c:47
        this = (Settings *) 0x61aaf0
        home = 0x7fffee923e91 "/home/cyril"
        rcfile = 0x0
        ok = false
#5  0x0000000000407bfc in main (argc=1, argv=0x7fffee921f98) at htop.c:270
        delay = -1
        userOnly = false
        userId = 0
        sortKey = 0
        arg = 1
        panel = (Panel *) 0x2b9ebcbb65c8
        quit = 0
        refreshTimeout = 0
        resetRefreshTimeout = 5
        doRefresh = true
        settings = (Settings *) 0x2b9ebc871fd8
        killPanel = (Panel *) 0x0
        incSearchBuffer = '\0' <repeats 39 times>
        incSearchIndex = 0
        incSearchMode = false
        pl = (ProcessList *) 0x61a100
        ut = (UsersTable *) 0x61a010
        header = (Header *) 0x61a980
        headerHeight = 32767
        searchFunctions = {0x0, 0x0, 0x0}
        searchKeys = {0x0, 0x0, 0x0}
        searchEvents = {0, 0, 0}
        searchBar = (FunctionBar *) 0x7fffee921ea8
        defaultFunctions = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
        defaultBar = (FunctionBar *) 0xf63d4e2e
        acc = -292413808
        follow = false
        tv = {tv_sec = 0, tv_usec = 0}
        newTime = 0
        oldTime = 2.3695764148749076e-310
        recalculate = false
        ch = -1128569400
        closeTimeout = 11166

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to