[PATCH] Make VLA size checker detect negative array sizes

Jordan Rose jordan_rose at apple.com
Mon Jun 16 13:01:26 PDT 2014


Getting back to this late. Would it be better to use constraints to check this?

if (!state->assume(/* size >= 0 */)) { /* error */ }

Jordan


On Jun 5, 2014, at 4:41 , Daniel Fahlgren <daniel at fahlgren.se> wrote:

> Hi,
> 
> The following patch makes the VLA size checker detect and warn about
> code like:
> 
>  int i = -4;
>  char array[i];
> 
> The old behavior was to silently convert it to a size_t.
> 
> Best regards,
> Daniel Fahlgren
> <VLA.patch>




More information about the cfe-commits mailing list