Skip to content
This repository was archived by the owner on Mar 30, 2021. It is now read-only.

Commit d75eca2

Browse files
author
Adam Balogh
committed
[Analyzer] Iterator Checkers - Crash Fix
When relating iterator positions the relation may be impossible because of the constraints. In this case the new state we get is a null pointer. If so, return a null pointer immediately instead of working with the invalid (null pointer) state wihch crashes the analyzer.
1 parent a649a1f commit d75eca2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/StaticAnalyzer/Checkers/IteratorChecker.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,9 @@ ProgramStateRef relateIteratorPositions(ProgramStateRef State,
21212121
"Symbol comparison must be a `DefinedSVal`");
21222122

21232123
auto NewState = State->assume(comparison.castAs<DefinedSVal>(), Equal);
2124+
if (!NewState)
2125+
return nullptr;
2126+
21242127
if (const auto CompSym = comparison.getAsSymbol()) {
21252128
assert(isa<SymIntExpr>(CompSym) &&
21262129
"Symbol comparison must be a `SymIntExpr`");

0 commit comments

Comments
 (0)