diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-04-05 05:18:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-04-05 05:18:05 +0000 |
commit | 04a18c9f42e91db1b2d2c7483723c1cd321c3d39 (patch) | |
tree | 74d5e6e28a57e4961b256d596f593d3269fac17d /lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp | |
parent | bb3d20f80c98e7919411bc7e062d69b17462899b (diff) |
Teach ObjCContainersChecker that the array passed to CFArrayGetValueAtIndex might not be a symbolic value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp index 69e8fbb7ab..207d65ad8f 100644 --- a/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp @@ -40,7 +40,6 @@ class ObjCContainersChecker : public Checker< check::PreStmt<CallExpr>, inline SymbolRef getArraySym(const Expr *E, CheckerContext &C) const { SVal ArrayRef = C.getState()->getSVal(E, C.getLocationContext()); SymbolRef ArraySym = ArrayRef.getAsSymbol(); - assert(ArraySym); return ArraySym; } @@ -120,8 +119,12 @@ void ObjCContainersChecker::checkPreStmt(const CallExpr *CE, // Retrieve the size. // Find out if we saw this array symbol before and have information about it. const Expr *ArrayExpr = CE->getArg(0); - const DefinedSVal *Size = - State->get<ArraySizeMap>(getArraySym(ArrayExpr, C)); + SymbolRef ArraySym = getArraySym(ArrayExpr, C); + if (!ArraySym) + return; + + const DefinedSVal *Size = State->get<ArraySizeMap>(ArraySym); + if (!Size) return; |