This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Demangler fuzzer


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]