Bug#391840: ztcfg segfaults because of -O4

Robert Millan rmh at aybabtu.com
Sun Oct 8 19:37:51 UTC 2006


Package: zaptel
Version: 1:1.2.9.1.dfsg-1
Severity: important

When compiled with -finline-functions (implied by -O4), ztcfg segfaults:

$ sudo gdb --args ztcfg -vvv
[...]
(gdb) r
Starting program: /usr/sbin/ztcfg -vvv
Notice: Configuration file is /etc/zaptel.conf
line 221: Cannot get number of tones for channel 1
line 221: Cannot init tones for channel 1
line 221: Cannot set rxtone on channel 1
[...]
line 221: Cannot set txtone on channel 2
line 221: Cannot set txtone on channel 2

Program received signal SIGSEGV, Segmentation fault.
rad_chanconfig (keyword=<value optimized out>, args=<value optimized out>) at ztcfg.c:937
937                                     if (rxtones[i])
(gdb) p i
$1 = 33992
(gdb) bt
#0  rad_chanconfig (keyword=<value optimized out>, args=<value optimized out>) at ztcfg.c:937
#1  0x0000000000401430 in main (argc=<value optimized out>, argv=<value optimized out>) at ztcfg.c:1213
(gdb) quit

(I guess the segfault condition only happens when you get the rxtone errors
shown above, so it's possible you can't reproduce this)

You might want to add -fno-inline-functions to CFLAGS as a workaround (tested
and known to work).  Besides, I'm not sure if this also qualifies as a gcc bug
and should be reported separately.  Could someone enlighten me? :-)

Ah, there's also this check I added to ensure 'i' will never be bigger than
the array size.  Not that it was any useful because gcc was screwing our
stack, but you might like to apply it as well.

diff -ur zaptel-1.2.9.1.dfsg.old/ztcfg.c zaptel-1.2.9.1.dfsg/ztcfg.c
--- zaptel-1.2.9.1.dfsg.old/ztcfg.c     2006-02-01 03:33:54.000000000 +0100
+++ zaptel-1.2.9.1.dfsg/ztcfg.c 2006-10-08 21:22:27.000000000 +0200
@@ -929,6 +929,8 @@
                        if (ind_ioctl(x,fd,ZT_RADIO_GETPARAM,&p) == -1)
                                error("Cannot get number of tones for channel %d\n",x);
                        n = p.data;
+                       if (n > NUM_TONES)
+                               error("Too many tones for channel %d: %d\n",x,n);
                        p.radpar = ZT_RADPAR_INITTONE;
                        if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
                                error("Cannot init tones for channel %d\n",x);

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to ca_AD.UTF-8)

Versions of packages zaptel depends on:
ii  fxload                    0.0.20020411-1 Firmware download to EZ-USB device
ii  libc6                     2.3.6.ds1-4    GNU C Library: Shared libraries
ii  libnewt0.52               0.52.2-7       Not Erik's Windowing Toolkit - tex
ii  libusb-0.1-4              2:0.1.12-2     userspace USB programming library
ii  procps                    1:3.2.7-3      /proc file system utilities

Versions of packages zaptel recommends:
ii  zaptel-modules-2.6. 1:1.2.9.1.dfsg-1+rmh zaptel modules for Linux (kernel 2

-- no debconf information




More information about the Pkg-voip-maintainers mailing list