[PING PATCH] demangler, only access valid fields for DEMANGLE_COMPONENT_FIXED_TYPE.

2014-08-19 Thread Gary Benson
Hi all, I just retested this patch. The crash it fixes is still there, and the patch still fixes it. Is this ok to commit? Cheers, Gary Andrew Burgess wrote: In two places when a struct demangle_component is of type DEMANGLE_COMPONENT_FIXED_TYPE we fall back to accessing the default

[COMMITTED PATCH] Demangler fuzzer

2014-08-13 Thread Gary Benson
Ian Lance Taylor wrote: On Tue, Aug 12, 2014 at 10:11 AM, Gary Benson gben...@redhat.com wrote: Ian Lance Taylor wrote: I think that by default the program should stop. That will make it possible to eventually run as part of make check. Give it some number of iterations that stops

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Gary Benson
Jakub Jelinek wrote: On Mon, Aug 11, 2014 at 05:04:20PM +0100, Gary Benson wrote: + case 's': + seed = atoi (optarg); + break; + + case 't': + timeout = atoi (optarg); + break; + + case 'm': + maxcount = atoi (optarg); + break

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Gary Benson
Jakub Jelinek wrote: On Tue, Aug 12, 2014 at 10:02:40AM +0100, Gary Benson wrote: I've removed the timeout code. Users can limit the run by setting a maximum number of iterations. That's more consistent for testing anyway: 500 iterations is 500 iterations wherever you run

Re: [PATCH] Demangler fuzzer

2014-08-12 Thread Gary Benson
Ian Lance Taylor wrote: On Tue, Aug 12, 2014 at 2:02 AM, Gary Benson gben...@redhat.com wrote: +#include demangle.h Include demangle.h with . Ok. +int +main (int argc, char *argv[]) +{ + char symbol[2 + MAXLEN + 1] = _Z; + int seed = -1, seed_set = 0; + int count = 0

[PATCH] Demangler fuzzer

2014-08-11 Thread Gary Benson
Hi all, This patch adds a simple fuzzer for the libiberty C++ demangler. You can run it like this: make -C /path/to/build/libiberty/testsuite fuzz-demangler It will run until it dumps core (usually only a few seconds). Is this ok to commit? Thanks, Gary -- 2014-08-11 Gary Benson gben

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Gary Benson
Jakub Jelinek wrote: On Mon, Aug 11, 2014 at 10:27:03AM +0100, Gary Benson wrote: This patch adds a simple fuzzer for the libiberty C++ demangler. You can run it like this: make -C /path/to/build/libiberty/testsuite fuzz-demangler It will run until it dumps core (usually only

Re: [PATCH] Demangler fuzzer

2014-08-11 Thread Gary Benson
David Malcolm wrote: On Mon, 2014-08-11 at 08:06 -0700, Andi Kleen wrote: Gary Benson gben...@redhat.com writes: srand(time(NULL)); That's really bad, can never be reproduced. If you use a random seed like this you need to at least print it. How about taking the random seed

Re: [PATCH] cplus-demangler, free resource after a failed call to gnu_special.

2014-05-22 Thread Gary Benson
Hi Thomas, Thomas Schwinge wrote: In GCC, I'm consistenly seeing the following new failure: ./test-demangle ../../../source/libiberty/testsuite/demangle-expected FAIL at line 4350, options --format=auto --no-params: in:

Re: [PATCH] cplus-demangler, free resource after a failed call to gnu_special.

2014-05-22 Thread Gary Benson
Thomas Schwinge wrote: On Thu, 22 May 2014 17:02:08 +0100, Gary Benson gben...@redhat.com wrote: Thomas Schwinge wrote: In GCC, I'm consistenly seeing the following new failure: ./test-demangle ../../../source/libiberty/testsuite/demangle-expected FAIL at line 4350

Re: [PATCH] cplus-demangler, free resource after a failed call to gnu_special.

2014-05-14 Thread Gary Benson
Ian Lance Taylor wrote: Andrew Burgess aburg...@broadcom.com wrote: On 09/05/2014 9:53 PM, Ian Lance Taylor wrote: Andrew Burgess aburg...@broadcom.com wrote: if ((AUTO_DEMANGLING || GNU_DEMANGLING)) { success = gnu_special (work, mangled, decl); +

Re: [PATCH] cplus-demangler, free resource after a failed call to gnu_special.

2014-05-14 Thread Gary Benson
Andrew Burgess wrote: On 14/05/2014 10:01 AM, Gary Benson wrote: Ian Lance Taylor wrote: Andrew Burgess aburg...@broadcom.com wrote: On 09/05/2014 9:53 PM, Ian Lance Taylor wrote: Andrew Burgess aburg...@broadcom.com wrote: if ((AUTO_DEMANGLING || GNU_DEMANGLING

[C++ PATCH] demangler fix

2014-05-07 Thread Gary Benson
] https://sourceware.org/bugzilla/show_bug.cgi?id=16845 2014-05-07 Gary Benson gben...@redhat.com * cp-demangle.c (struct d_component_stack): New structure. (struct d_print_info): New field component_stack. (d_print_init): Initialize the above. (d_print_comp_inner

[PATCH, libiberty] Remove malloc/realloc from demangler (was: Add a couple of missing casts)

2013-12-20 Thread Gary Benson
Ian Lance Taylor wrote: On Wed, Nov 13, 2013 at 7:30 AM, Gary Benson gben...@redhat.com wrote: Richard Biener wrote: On Tue, Nov 12, 2013 at 8:55 PM, Ian Lance Taylor i...@google.com wrote: On Tue, Nov 12, 2013 at 11:24 AM, Uros Bizjak ubiz...@gmail.com wrote

Re: [PATCH, libiberty]: Add a couple of missing casts

2013-11-13 Thread Gary Benson
Richard Biener wrote: On Tue, Nov 12, 2013 at 8:55 PM, Ian Lance Taylor i...@google.com wrote: On Tue, Nov 12, 2013 at 11:24 AM, Uros Bizjak ubiz...@gmail.com wrote: This was uncovered by x86 lto-profiledbootstrap. The patch allows lto-profiledbootstrap to proceed further.

[2nd PING] [C++ PATCH] demangler fix (take 2)

2013-10-08 Thread Gary Benson
100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,20 @@ +2013-09-17 Gary Benson gben...@redhat.com + + * cp-demangle.c (struct d_saved_scope): New structure. + (struct d_print_info): New fields saved_scopes and + num_saved_scopes. + (d_print_init): Initialize

[PING] [C++ PATCH] demangler fix (take 2)

2013-09-27 Thread Gary Benson
Gary Benson wrote: Hi all, This is a resubmission of my previous demangler fix [1] rewritten to avoid using hashtables and other libiberty features. From the above referenced email: d_print_comp maintains a certain amount of scope across calls (namely a stack of templates) which

[C++ PATCH] demangler fix (take 2)

2013-09-17 Thread Gary Benson
--- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,20 @@ +2013-09-17 Gary Benson gben...@redhat.com + + * cp-demangle.c (struct d_saved_scope): New structure. + (struct d_print_info): New fields saved_scopes and + num_saved_scopes. + (d_print_init): Initialize

Re: C++ demangler fix

2013-09-11 Thread Gary Benson
Jakub Jelinek wrote: cp-demangle.c isn't used just in libiberty, where using hashtab, xcalloc, XNEW etc. is fine, but also in libsupc++/libstdc++, where none of that is fine. That is why cp-demangle.c only uses e.g. realloc, checks for allocation failures and propagates those to the caller

C++ demangler fix

2013-09-04 Thread Gary Benson
/libiberty/ChangeLog index e4ce0b9..a084282 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,22 @@ +2013-09-04 Gary Benson gben...@redhat.com + + * cp-demangle.c: Include hashtab.h. + (struct d_print_info): New field saved_scopes. + (d_print_init): Initialize