Glibc bug?

Dimitrios Stasinopoulos dimitris at linea.gr
Sat Feb 23 15:59:01 EET 2002


Hello All!

Opoios brei ti ginetai edo, mpainei sto AUTHORS :o)

Exoume ton constructor tis class Question:

Question::Question(char * question)
{
int size=15;
char * label=0;

cout << "Question::Question()" << endl;

label=(char *)malloc(size+1);
	if(label)
	{
	memset(label, 0, size+1);
	free(label);
	label=0;
	}
}

(Sxolia gia to indentation kante ta forward sto /dev/null - efxaristo)

se mia fasi kaleitai o constructor gia na ftiaksei ena Question object, 
kai deite edo ti ginetai (mesa apo gdb):

Question::Question()

Program received signal SIGSEGV, Segmentation fault.
0x4010e36d in ?? ()
(gdb) bt
#0  0x4010e36d in ?? ()
#1  0x4010e03a in ?? ()
#2  0x4010d814 in ?? ()
#3  0x804b939 in Question::Question (this=0xbffff438,
    question=0x8053d28 "\bmagnusii\006kronos\003net\t") at question.cpp:27
#4  0x804daf7 in main (argc=1, argv=0xbffff764) at main.cpp:191
#5  0x400b8baf in ?? ()
(gdb)

mia fora etixe na mou petaksei to eksis:

Program received signal SIGSEGV, Segmentation fault.
0x4010e36d in chunk_free () from /lib/libc.so.6
(gdb) bt
#0  0x4010e36d in chunk_free () from /lib/libc.so.6
#1  0x4010e03a in chunk_alloc () from /lib/libc.so.6
#2  0x4010d814 in malloc () from /lib/libc.so.6
#3  0x804bad1 in Question::Question (this=0xbffff438,
    question=0x8054248 "\bmagnusii\006kronos\003net\t") at question.cpp:60
#4  0x804df77 in main (argc=1, argv=0xbffff764) at main.cpp:191
#5  0x400b8baf in __libc_start_main () from /lib/libc.so.6
(gdb)

Ti exoume edo? Bug stin glibc?

Kai tora to ENTELOS koufo tis ipothesis. Kano to eksis:
Bazo ena akoma malloc(), akribos prin to proto, kai akribos idio:

cout << "Question::Question()" << endl;

label=(char *)malloc(size+1);
label=(char *)malloc(size+1);
	if(label)
	{
	memset(label, 0, size+1);
	free(label);
	label=0;
	}

kai aftin ti fora paizei kanonika! Epeidi DEN exo asxolithei me ta 
endotera tis glibc (kai epeidi exo iposxethei ston eafto mou na mpo sto 
mourlokomeio mono otan giriso mia mera spiti kai do lemmings na perpatane 
pano sto keyboard mou), mipos exei kaneis kamia idea ti ston lousti 
ginetai? (ipenthimizo to AUTHORS!)

linux 2.4.12 
glibc-2.2-7
gcc-2.95.2-149
(suse 7.1)

Dimitris Stasinopoulos







More information about the Linux-greek-users mailing list