[PATCH] Fix analyzer crash when defining strange prototype of malloc

Jordan Rose jordan_rose at apple.com
Wed Sep 3 19:18:12 PDT 2014


This seems like a reasonable approach. It's not wonderful, but it's more a sanity check than anything else, right?

Feel free to remove the check from a few lines down. Please add a test case as well.

Thanks for catching this!
Jordan


On Aug 25, 2014, at 1:49 , Daniel Fahlgren <daniel at fahlgren.se> wrote:

> Hi,
> 
> If you change the prototype of malloc it is possible to cause the
> analyzer to crash. This simple example will give you such a crash:
> 
> void malloc(int i);
> 
> void foo()
> {
>  malloc(1);
> }
> 
> It is the assertion on line 161 in SValBuilder.cpp that fails. Attached
> is a simple patch that fixes this, but I'm not sure the fix is correct.
> There seems to be a similar check a couple of lines further down in the
> code.
> 
> Best regards,
> Daniel Fahlgren
> <analyzer_crash.patch>




More information about the cfe-commits mailing list