aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-08-29 20:05:54 +0000
committerAnna Zaks <ganna@apple.com>2011-08-29 20:05:54 +0000
commit5c96f862b7789594b11db74416af12e379a299b9 (patch)
treebcc270e9e93e7b27724c1991a106502856c6b2c2 /lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
parentb1f2f4782097ed5e0a760598cbb853864cf9d7ce (diff)
Fix bug 10797: Crash: "cast<Ty>() argument of incompatible type!" assert when analyzing ICU.
Patch by Jean-Daniel Dupas. Thanks for spotting and fixing! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
index 40c9c72dc2..1c9390217f 100644
--- a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
@@ -201,9 +201,11 @@ static SymbolRef getSymbolForRegion(CheckerContext &C,
if (!isa<SymbolicRegion>(R)) {
// Implicit casts (ex: void* -> char*) can turn Symbolic region into element
// region, if that is the case, get the underlining region.
- if (const ElementRegion *ER = dyn_cast<ElementRegion>(R))
+ if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
R = ER->getAsArrayOffset().getRegion();
- else
+ if (!isa<SymbolicRegion>(R))
+ return 0;
+ } else
return 0;
}
return cast<SymbolicRegion>(R)->getSymbol();