Bug#732207: tvtime: Fails to install + segfault
reassign 732207 tvtime
retitle 732207 tvtime: tvtime-configure segfaults on 64-bit systems
thanks
On Wed, Dec 18, 2013 at 02:52:25PM +0100, Alban Browaeys wrote:
> Package: tvtime
> Followup-For: Bug #732207
>
> Dear Maintainer,
> I rebuild with dh_strip off. Which gives:
>
> gdb --args tvtime-configure --configfile=/etc/tvtime/tvtime.xml --norm=SECAM --frequencies=france --device=/dev/video0 --vbidevice=/dev/vbi0 --priority=-10
>
> Program received signal SIGSEGV, Segmentation fault.
> __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:42
> 42 ../sysdeps/x86_64/multiarch/../strlen.S: Aucun fichier ou dossier de ce type.
> (gdb) bt
> #0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:42
> #1 0x0000000000401a1e in main (argc=7, argv=0x7fffffffbce8) at tvtime-configure.c:39
> (gdb) up
> #1 0x0000000000401a1e in main (argc=7, argv=0x7fffffffbce8) at tvtime-configure.c:39
> 39 if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
>
>
> It turns out that getenv always fails here (amd64), quick test for to reproduce:
> $ gdb bash
> (gdb) b main
> (gdb) r
> (gdb) p/s (char *)getenv("HOME")
> $1 = 0xffffffffffffea8a <Address 0xffffffffffffea8a out of bounds>
>
> Definitely looks like libc6 is broken on amd64 for its 2.17-97 deb at least (I tested with same libc6 version,
> on debian sid too on arm 32 (cortex A9) and i386 also 32 all is fine.
>
> critical indeed , you might want to reassign to libc6 (or I will tomorrow)
It is broken if you don't use the correct includes and the compiler
consider the strings are an int argument. Compiling tvtime with -Wall
should give you a hint:
| if x86_64-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -Wall -pedantic -I. -DDATADIR="\"/usr/share/tvtime\"" -DCONFDIR="\"/etc/tvtime\"" -DFIFODIR="\"/tmp\"" -D_LARGEFILE64_SOURCE -DLOCALEDIR="\"/usr/share/locale\"" -I/usr/include/libxml2 -g -O3 -fomit-frame-pointer -std=gnu99 -MT tvtime_configure-tvtime-configure.o -MD -MP -MF ".deps/tvtime_configure-tvtime-configure.Tpo" \
| -c -o tvtime_configure-tvtime-configure.o `test -f 'tvtime-configure.c' || echo './'`tvtime-configure.c; \
| then mv -f ".deps/tvtime_configure-tvtime-configure.Tpo" ".deps/tvtime_configure-tvtime-configure.Po"; \
| else rm -f ".deps/tvtime_configure-tvtime-configure.Tpo"; exit 1; \
| fi
| tvtime-configure.c: In function 'main':
| tvtime-configure.c:38:5: warning: implicit declaration of function 'getenv' [-Wimplicit-function-declaration]
| if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
| ^
| tvtime-configure.c:38:5: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
| tvtime-configure.c:38:80: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default]
| if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
| ^
| tvtime-configure.c:39:5: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
| if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
| ^
| tvtime-configure.c:39:9: warning: incompatible implicit declaration of built-in function 'strlen' [enabled by default]
| if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
| ^
| tvtime-configure.c:39:5: warning: passing argument 1 of 'strlen' makes pointer from integer without a cast [enabled by default]
| if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
| ^
| tvtime-configure.c:39:5: note: expected 'const char *' but argument is of type 'int'
| tvtime-configure.c:39:87: warning: incompatible implicit declaration of built-in function 'exit' [enabled by default]
| if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
Adding a #include <string.h> and a #include <stdlib.h> fixes the
problem.
Reassigning back the bug to tvtime.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
Reply to: