Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
> I reproduced the bug with a help of Grzegorz's point for 64-bit box. So, patch
> is attached and I'm going to commit it
> ! Conf->flagval[(unsigned int) *s] = (unsigned char) val;
> ! Conf->flagval[*(unsigned char*) s] = (unsigned char) val;
Maybe I'm missing something but I don't understand how this fixes the problem.
s is a "char*" so type punning it to an unsigned char * before dereferencing
it is really the same as casting it to unsigned char directly and casting it
to unsigned int really ought to have done the same thing anyways.
All of the changes are of this type so I can't see how your patch could have
fixed the problem.
And in general casting the pointer before dereferencing it is a whole lot
scarier code which should raise eyebrows a lot faster than just a simple cast
to unsigned char like you had it originally.
What really boggles me is why you don't just use unsigned chars everywhere and
remove all of these casts. or would that just move the casts to strcmp and
Ask me about EnterpriseDB's Slony Replication support!
In response to
pgsql-general by date
|Next:||From: Teodor Sigaev||Date: 2009-01-29 16:00:24|
|Subject: Re: Text search segmentation fault|
|Previous:||From: Richard Broersma||Date: 2009-01-29 15:46:13|
|Subject: Re: Pet Peeves?|