[PATCH] D79330: [Analyzer][VLASizeChecker] Check for VLA size overflow.
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 4 08:32:45 PDT 2020
martong added inline comments.
================
Comment at: clang/test/Analysis/vla.c:107
+ if (x == BIGINDEX) {
+ size_t s = sizeof(int[x][x][x][x]); // expected-warning{{Declared variable-length array (VLA) has too large size}}
+ return s;
----------------
I think we could make the arithmetic more clear here:
x = BIGINDEX 65536 (2^16) and `char[x][x][x][x]` would be the first to overflow.
And `char[x][x][x][x-1]` should not overflow.
And if we are at it, then `size_t`'s range is target dependent, so I think we must extend the `RUN` line with `-target`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79330/new/
https://reviews.llvm.org/D79330
More information about the cfe-commits
mailing list