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

2011-03-06 Thread Michael Snyder
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 0xfffb and 0x - and in the case where it would use [30], it's supposed to abort anyway. I couldn't figure out why

[RFA] libiberty/make-relative-prefix.c, save_string, use xmalloc over malloc

2011-03-06 Thread Michael Snyder
I know the callers of save_string check its return value for null, but by then it's too late -- we've memcpy'd over a null pointer. OK? 2011-03-06 Michael Snyder * make-relative-prefix.c (save_string): Use xmalloc over malloc. Index: make-re

[RFA] libiberty/argv.c, expandargv, close memory leak

2011-03-06 Thread Michael Snyder
OK? 2011-03-06 Michael Snyder * argv.c (expandargv): Close memory leak. Index: argv.c === RCS file: /cvs/src/src/libiberty/argv.c,v retrieving revision 1.22 diff -u -p -r1.22 argv.c --- argv.c 13 Aug 2010 11:36:10

Re: libiberty/cplus-dem.c, ada-demangle: plug memory leak.

2011-03-04 Thread Michael Snyder
Tom Tromey wrote: "Michael" == Michael Snyder writes: Michael> Are you sure? There is a path to "goto unknown" from before the Michael> call to the alloc function. It might actually be null. Some Michael> versions of 'free' don't like that.

Re: libiberty/cplus-dem.c, ada-demangle: plug memory leak.

2011-03-04 Thread Michael Snyder
Tristan Gingold wrote: On Mar 3, 2011, at 10:59 PM, Michael Snyder wrote: Jakub Jelinek wrote: On Thu, Mar 03, 2011 at 01:20:28PM -0800, Michael Snyder wrote: 2011-03-03 Michael Snyder * libiberty/cplus-dem.c (ada_demangle): Stop memory leak. Also fix a one line indent

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

2011-03-03 Thread Michael Snyder
Mike Stump wrote: On Mar 3, 2011, at 2:26 PM, Michael Snyder wrote: DJ Delorie wrote: As written, the function will access element [30] of a 30-element array. Um, no? Y-uh-huh! fight fight fight... :-) There can be only one. Oh, did I forget the smiley? ;-)

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

2011-03-03 Thread Michael Snyder
DJ Delorie wrote: As written, the function will access element [30] of a 30-element array. Um, no? unsigned int mid = low + (high - low) / 2; This can never give mid == high unless low == high, which won't happen in that loop. The math wants to search everything from (including) low to

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

2011-03-03 Thread Michael Snyder
DJ Delorie wrote: As written, the function will access element [30] of a 30-element array. Um, no? Y-uh-huh! unsigned int mid = low + (high - low) / 2; This can never give mid == high unless low == high, which won't happen in that loop. The math wants to search everything from (incl

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

2011-03-03 Thread Michael Snyder
As written, the function will access element [30] of a 30-element array. OK? 2011-03-03 Michael Snyder * hashtab.c (higher_prime_index): Prevent array overrun. Index: hashtab.c === RCS file: /cvs/src/src/libiberty

Re: libiberty/cplus-dem.c, ada-demangle: plug memory leak.

2011-03-03 Thread Michael Snyder
Jakub Jelinek wrote: On Thu, Mar 03, 2011 at 01:20:28PM -0800, Michael Snyder wrote: 2011-03-03 Michael Snyder * libiberty/cplus-dem.c (ada_demangle): Stop memory leak. Also fix a one line indent problem. No libiberty/ in libiberty/ChangeLog. @@ -1129,10 +1129,11

libiberty/cplus-dem.c, ada-demangle: plug memory leak.

2011-03-03 Thread Michael Snyder
We don't have a separate libiberty list, do we? 2011-03-03 Michael Snyder * libiberty/cplus-dem.c (ada_demangle): Stop memory leak. Also fix a one line indent problem. Index: cplus-dem.c === RCS file: /cv