@edgy - segmentation fault strlen - implicated apt-get, aptitude, synaptic, adept
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
when I try to use apt-get (or similar) I found a Segmentation Fault:
apt-get dist-upgrade
Segmentation faulta dei pacchetti in corso... 0%
I tried to debug this with gdb, and:
-------
(gdb) run dist-upgrade
Starting program: /usr/bin/apt-get dist-upgrade
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Lettura della lista dei pacchetti in corso... 0%
Program received signal SIGSEGV, Segmentation fault.
0xb7d19673 in strlen () from /lib/libc.so.6
(gdb) x/i $eip
0xb7d19673 <strlen+51>: mov (%eax),%ecx
(gdb) info stack
#0 0xb7d19673 in strlen () from /lib/libc.so.6
#1 0xb7e8e126 in std::string:
#2 0xb7f7d428 in debPackagesInde
#3 0xb7f42b44 in pkgCacheGenerat
#4 0xb7f439b7 in pkgMakeStatusCache () from /usr/lib/
#5 0xb7f3941c in pkgCacheFile:
#6 0xb7f39504 in pkgCacheFile::Open () from /usr/lib/
#7 0x0805df6b in ?? ()
#8 0xb7f0613d in CommandLine:
#9 0x0804ee25 in ?? ()
#10 0xb7cc58cc in __libc_start_main (main=0x804eb86 <strcpy@plt+8186>, argc=2, ubp_av=0xbffe07c4,
init=0x80635ed <std::vector<
fini=0x80635e8 <std::vector<
rtld_
#11 0x0804cbc1 in ?? ()
(gdb)
------
It seems the problem is in strlen. So I tryed this simple source:
#include <strings.h>
#include <stdio.h>
int main(int argc, char **argv)
{
if(argc>1)
return 0;
}
and:
./a.out a
Segmentation fault (core dumped)
I've core files and other details if they'll be necessary.
Thanks...
..ryuujin
Your test program is guaranteed to fail. You do strlen() on a nonexistant string (I think you wanted argv[1], which would give you the "a").
It is extremely unlikely that the problem is actually in strlen(): strlen() only uncovered the problem.