[analyzer] Ignore calculated indices of <= 0 in VLASizeChecker
authorVince Bridgers <vince.a.bridgers@gmail.com>
Mon, 1 Jun 2020 00:03:16 +0000 (19:03 -0500)
committereinvbri <vince.a.bridgers@ericsson.com>
Thu, 4 Jun 2020 12:25:35 +0000 (07:25 -0500)
commitbd425825411af1b340134b0e8c9c03733ee87d66
tree537859e2ac4a5e4a1352cc07dc57d5b58d369e43
parentecbf34c0e480654206330e53d8a103e824329083
[analyzer] Ignore calculated indices of <= 0 in VLASizeChecker

Summary:
See https://bugs.llvm.org/show_bug.cgi?id=46128. The checker does not
yet comprehend constraints involving multiple symbols, so it's possible
to calculate a VLA size that's negative or 0. A LIT is added to catch
regressions, and this change simply bails if a VLA size of 0 or less is
calculated.

Reviewers: balazske, NoQ, martong, baloghadamsoftware, Szelethus, gamesh411

Reviewed By: balazske, NoQ, Szelethus

Subscribers: xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, Charusso, ASDenysPetrov, cfe-commits, dkrupp

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80903
clang/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
clang/test/Analysis/vla.c