]> granicus.if.org Git - clang/commitdiff
[ODRHash] Avoid dereferencing end() of a SmallVector.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 22 Feb 2017 10:19:45 +0000 (10:19 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 22 Feb 2017 10:19:45 +0000 (10:19 +0000)
Found by MSAN.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295820 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp

index c8ee5c652986275ad0fa1c8947bf25051e3f18ea..01e1340f9bde536dc2b4e8b48e7d866db69dfa7d 100644 (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;