[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [roessler@guug.de: Re: [bartw@xs4all.nl: Bug#47981: Mutt segv on viewing list of attachments]]

"Marco d'Itri" <md@linux.it> writes:

> 	struct s *idx[2];

So you have a array of two pointers with random values.

> 	safe_free (&idx[1]);	/* after this line, idx[1] should be NULL.
> 				 * however, safe_free zeroes idx[0].
> 			         */

So idx[1] == NULL, but idx[0] == random

> 	idx[0]->x = NULL;	/* segv */

This writes at a random adress plus the offset of x, which makes it
somewhere random and segfaults. Just as it should.

> 	safe_free(&idx[0]);
> That is, safe_free () zeroes out a pointer it should not zero out
> according to the C code.  This might be a compiler bug.

idx[0] was never initialised and should never work on any system.

Compile your code with "-W -Wall -Wstrict-aliasing" and maybe even
with "-Werror" as I do wherever possible.

> So, in order to debug this, some knowledge of Alphas' machine
> language and architecture would be necessary.

Debuging on alpha doesn´t differ from debuging on any other arch. You
don´t need to go down to the asm level. Try gdb or ddd (for mouse
pushers :).

May the Source be with you.

Reply to: