[RFA] libiberty/hashtab.c, higher_prime_index: avoid array overrun

Michael Snyder msnyder@vmware.com
Mon Mar 7 00:51:00 GMT 2011


DJ Delorie wrote:
> Bizzare, the problem isn't the hash loop, it's the error handler at
> the end!  It never uses [30] for the main loop, only if you give it a
> number between 0xfffffffb and 0xffffffff - and in the case where it
> would use [30], it's supposed to abort anyway.
> 
> I couldn't figure out why your patch worked until I realized that the
> main loop still fails!  It works because the error handler just
> doesn't abort, returning the last array entry, which happens to be the
> right one.
> 
> I think a suitable comment explaining what's actually going on, and
> why it still works, is warranted... but your patch is OK with me
> otherwise :-)

Please give me the comment, and I'll check it in.




More information about the Gcc-patches mailing list