Package: qps
Version: 1.9.18.6-2.2
Severity: normal

$ apt-get source qps
$ cd qps-1.9.18.6
$ debian/rules build
$ gdb ./qps
(gdb) run
(gdb) bt
#0  0x00007f8957c7c779 in rawmemchr () from /lib/libc.so.6
#1  0x00007f8957c6e8aa in ?? () from /lib/libc.so.6
#2  0x00007f8957c62bb5 in vsscanf () from /lib/libc.so.6
#3  0x00007f8957c51868 in sscanf () from /lib/libc.so.6
#4  0x0000000000420ff8 in Procinfo::read_common () at proc.cpp:801
#5  0x0000000000423a80 in Proc::refresh (this=0x6) at proc.cpp:1460
#6  0x000000000042555d in Procview::refresh (this=0x1da0e20) at 
proc_common.cpp:266
#7  0x000000000041f130 in Pstable::refresh (this=0x1da11d0) at pstable.cpp:371
#8  0x00000000004169da in Qps::set_table_mode (this=0x1d7b750, treemode=false) 
at qps.cpp:865
#9  0x000000000041b7dc in Qps (this=0x1d7b750) at qps.cpp:281
#10 0x000000000041c06d in main (argc=1, argv=0x7fff61ad4a58, envp=<value 
optimized out>) at qps.cpp:2008

Looking at proc.cpp, Procinfo::read_common ():
        char buf[4096 + 1]
        ...
        strcpy(path, PROCDIR);
        strcat(path, "/stat"); // /proc/stat
        if((n = read_file(path, buf, sizeof(buf) - 1)) <= 0) return;
        ...
        p = strstr(buf, "btime") + 6;
        sscanf(p, "%lu", &boot_time);
and 
$ wc -c /proc/stat 
8980 /proc/stat
it becomes clear that /proc/stat may be too large for buf.
$ less /proc/stat
clearly shows that 'btime' is almost at the end and 'intr' is
very large: p must be NULL.  (A NULL check should be added.)

proc.ccp is generated, in this case, from proc_linux.cpp.

Increasing the size of buf allows qps to parse the boot time
again and fixes the segfault for now.


diff -Nur qps-1.9.18.6-old/proc_linux.cpp qps-1.9.18.6/proc_linux.cpp
--- qps-1.9.18.6-old/proc_linux.cpp     2006-08-29 23:03:21.000000000 +0200
+++ qps-1.9.18.6/proc_linux.cpp 2009-05-25 21:06:28.000000000 +0200
@@ -666,7 +666,7 @@
 void Procinfo::read_common()
 {
        char path[80];
-       char buf[4096 + 1];
+       char buf[16384 + 1];

        char *p;
        int n;


-Wolfgang

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

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

Versions of packages qps depends on:
ii  libc6                         2.9-12     GNU C Library: Shared libraries
ii  libgcc1                       1:4.4.0-5  GCC support library
ii  libqt3-mt                     3:3.3.8b-5 Qt GUI Library (Threaded runtime v
ii  libstdc++6                    4.4.0-5    The GNU Standard C++ Library v3
ii  libx11-6                      2:1.2.1-1  X11 client-side library
ii  libxext6                      2:1.0.4-1  X11 miscellaneous extension librar

qps recommends no packages.

qps suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to