This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [Patch][BZ 14594] Demangle function pointers before testing them
Jeff Law <law@redhat.com> writes:
> The problem is the code is testing the mangled pointer against null which
> is blatently wrong
No, it is perfectly correct: the NULL pointer is never mangled in the
first place. Demangling the NULL pointer will never result in a NULL
pointer, and all you get is a crash.
> -- unless you can always guarantee that the mangling will never
> produce a zero result given a nonzero input.
That is trivial. Just make sure the canary is never a valid pointer
(you lose a bit of randomness, but that should not be a problem).
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."