[PATCH] Make VLA size checker detect negative array sizes
Jordan Rose
jordan_rose at apple.com
Tue Aug 12 09:54:17 PDT 2014
Looks good to me! Committed as r215456. I also split out the VLASizeChecker-related tests into a separate test file (including the existing ones) in case we have any later improvements. Thanks. Daniel!
Jordan
On Aug 11, 2014, at 9:08 , Daniel Fahlgren <daniel at fahlgren.se> wrote:
> Hi Jordan,
>
> On Mon, 2014-06-16 at 13:01 -0700, Jordan Rose wrote:
>> Getting back to this late. Would it be better to use constraints to check this?
>>
>> if (!state->assume(/* size >= 0 */)) { /* error */ }
>
> Sorry for the late reply. Vacation and life somehow got in the way of
> coding.
>
> Yes, that is be better. The old patch did not catch things like:
>
> static void bar(int x)
> {
> int vla[x];
> }
>
> void foo(int x) {
> if (x < 0)
> bar(x);
> }
>
> Attached is an updated version of the patch with the above test case.
> Since this is my first real encounter with constraints I'm sure things
> can be done in a better way. Feedback is welcome. :)
>
> Best regards,
> Daniel Fahlgren
> <VLA.patch>
More information about the cfe-commits
mailing list