[ODRHash] Avoid dereferencing end() of a SmallVector.

Found by MSAN.

llvm-svn: 295820
This commit is contained in:
Benjamin Kramer 2017-02-22 10:19:45 +00:00
parent 07056a06a0
commit 6f224d2bc0
1 changed files with 2 additions and 1 deletions

View File

@ -8987,7 +8987,8 @@ void ASTReader::diagnoseOdrViolations() {
// SecondDiffType will not be Other and FirstDecl and SecondDecl will be
// filled in if not EndOfClass.
while (FirstIt != FirstHashes.end() || SecondIt != SecondHashes.end()) {
if (FirstIt->second == SecondIt->second) {
if (FirstIt != FirstHashes.end() && SecondIt != SecondHashes.end() &&
FirstIt->second == SecondIt->second) {
++FirstIt;
++SecondIt;
continue;