--- Begin Message ---
Package: libc6
Version: 2.5-6
Severity: normal
Hi,
there happens a segmentation fault with the following code:
#include <stdio.h>
int main(int argc, char**argv)
{
printf("%s\n", strerror(atoi(argv[1])));
}
I have observed this on amd64 libc6 2.5-5 and 2.5-6,
it does not occur on i386 libc6 2.5-5.
The amd64 system is actually an amd64 schroot running on a sarge/i386
host.
If there is anything I can do to help you debug this, please let me
know. A small test log is appended below.
Andreas
$ vi strerror.c
$ gcc -g -o strerror strerror.c
$ ./strerror 0 ; echo $?
Segmentation fault
139
$ gdb ./strerror
GNU gdb 6.6-debian
....
This GDB was configured as "x86_64-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) set args 0
(gdb) run
Starting program: /home/beckmann/strerror 0
Program received signal SIGSEGV, Segmentation fault.
0x00002ad8f39eeab0 in strlen () from /lib/libc.so.6
(gdb) bt full
#0 0x00002ad8f39eeab0 in strlen () from /lib/libc.so.6
No symbol table info available.
#1 0x00002ad8f39beb15 in vfprintf () from /lib/libc.so.6
No symbol table info available.
#2 0x00002ad8f39c4a6a in printf () from /lib/libc.so.6
No symbol table info available.
#3 0x0000000000400549 in main (argc=2, argv=0x7fffff9b5838) at
strerror.c:5
No locals.
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (30, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.16.29.2.em64t-smp (SMP w/16 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
-- no debconf information
--- End Message ---
--- Begin Message ---
Andreas Beckmann a écrit :
> Package: libc6
> Version: 2.5-6
> Severity: normal
>
> Hi,
>
> there happens a segmentation fault with the following code:
>
> #include <stdio.h>
>
> int main(int argc, char**argv)
> {
> printf("%s\n", strerror(atoi(argv[1])));
> }
>
> I have observed this on amd64 libc6 2.5-5 and 2.5-6,
> it does not occur on i386 libc6 2.5-5.
>
> The amd64 system is actually an amd64 schroot running on a sarge/i386
> host.
>
> If there is anything I can do to help you debug this, please let me
> know. A small test log is appended below.
>
You are missing a #include <string.h>. And don't forget to always build
with -Wall.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
--- End Message ---