diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-09 00:44:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-09 00:44:16 +0000 |
commit | 159d2487e6b49f0aa64c44aef96bc9d643929931 (patch) | |
tree | 3f55f8f2e46c53255325dd42115a7bb6fbacb956 /lib/Analysis/GRExprEngine.cpp | |
parent | ca9bab0dcbaa980bd9e7131f43b3d3b055946983 (diff) |
[static analyzer] Extend VLA size checking to look for undefined sizes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index fb52067573..343ac697a3 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1820,6 +1820,14 @@ void GRExprEngine::VisitDeclStmt(DeclStmt* DS, NodeTy* Pred, NodeSet& Dst) { Expr* SE = VLA->getSizeExpr(); SVal Size = GetSVal(St, SE); + + if (Size.isUndef()) { + if (NodeTy* N = Builder->generateNode(DS, St, Pred)) { + N->markAsSink(); + ExplicitBadSizedVLA.insert(N); + } + continue; + } bool isFeasibleZero = false; const GRState* ZeroSt = Assume(St, Size, false, isFeasibleZero); @@ -1830,8 +1838,8 @@ void GRExprEngine::VisitDeclStmt(DeclStmt* DS, NodeTy* Pred, NodeSet& Dst) { if (isFeasibleZero) { if (NodeTy* N = Builder->generateNode(DS, ZeroSt, Pred)) { N->markAsSink(); - if (isFeasibleNotZero) ImplicitZeroSizedVLA.insert(N); - else ExplicitZeroSizedVLA.insert(N); + if (isFeasibleNotZero) ImplicitBadSizedVLA.insert(N); + else ExplicitBadSizedVLA.insert(N); } } |