Fix: Bug 10798 - [analyzer] Crash when analyzing ICU. (A slight improvement on the previous commit.)

llvm-svn: 138762
This commit is contained in:
Anna Zaks 2011-08-29 20:43:37 +00:00
parent 2bfaa32990
commit 814adf7752
2 changed files with 12 additions and 1 deletions

View 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;

View 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;
}