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

Re: bb segfault - will someone please confirm?



On Wed, Apr 13, 2005 at 05:42:20PM -0500, Pete Harlan wrote:
> On Tue, Apr 12, 2005 at 06:05:18PM -0400, Lennart Sorensen wrote:
> ...
> > If you fix this bug, it seems to run perfectly all the way through:
> > 
> > tex.c line 95:
> > Was: memset(zbuff, 0x55, (X_s * Y_s * sizeof(long)));
> > Should be: memset(zbuff, 0x55, (X_s * Y_s * sizeof(int)));
> > 
> > Len Sorensen
> 
> [Nice debugging work!]
> 
> Wouldn't it be better to use a type that is explicitly 32 bits wide,
> rather than relying on the compiler to use only 32 bits for an int?
> 
> If you just use int, it seems like you're making the same mistake that
> the original authors did.  (Unless the code uses int everywhere and
> doesn't care how many bits it holds, in which case the width doesn't
> actually matter as long as ints are used consistently.)
> 
> In any case, thanks!

No using int is correct, since that is what all the other functions for
zbuff use.  As long as they agree everything is fine.  When they don't
agree you get problems (like in this case doing a memset twice as far as
it was supposed to go.)  When you malloc with int, but memset with long,
you get problems.  Doing both with int is fine.

Len Sorensen



Reply to: