]> granicus.if.org Git - clang/commitdiff
Fix: Bug 10798 - [analyzer] Crash when analyzing ICU. (A slight improvement on the...
authorAnna Zaks <ganna@apple.com>
Mon, 29 Aug 2011 20:43:37 +0000 (20:43 +0000)
committerAnna Zaks <ganna@apple.com>
Mon, 29 Aug 2011 20:43:37 +0000 (20:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138762 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
test/Analysis/keychainAPI.m

index 1c9390217f79aeaf31203b42522dee431304a036..76d92874be15e4d1785b0eb24b98af77c2182fc0 100644 (file)
@@ -203,7 +203,7 @@ static SymbolRef getSymbolForRegion(CheckerContext &C,
     // region, if that is the case, get the underlining region.
     if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
       R = ER->getAsArrayOffset().getRegion();
-      if (!isa<SymbolicRegion>(R))
+      if (!R || !isa<SymbolicRegion>(R))
         return 0;
     } else
       return 0;
index 1969a9d169cf95ff3989778a2d10fb0ee31750b6..d10600dea590a6fa92211b9dd8dd2411f9ba1fb1 100644 (file)
@@ -310,3 +310,14 @@ __inline__ static
 const char *__WBASLLevelString(int level) {
   return "foo";
 }
+
+static int *bug10798(int *p, int columns, int prevRow) {
+  int *row = 0;
+  row = p + prevRow * columns;
+  prevRow += 2;
+  do {
+    ++prevRow;
+    row+=columns;
+  } while(10 >= row[1]);
+  return row;
+}