[PATCH] Demangler fuzzer

Jakub Jelinek jakub@redhat.com
Mon Aug 11 09:39:00 GMT 2014


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 a few seconds).
> 
> Is this ok to commit?

I think it is bad when the command never succeeds in case of success.
There should be some limit on the number of iterations (perhaps a parameter
to the program), or timeout.

> +      for (i = 0; i < length; i++)
> +	*(buffer++) = (rand () % (ALPMAX - ALPMIN)) + ALPMIN;
> +
> +      *(buffer++) = '\0';

Please use just *buffer++ instead of *(buffer++) in both places.

	Jakub



More information about the Gcc-patches mailing list