]> granicus.if.org Git - llvm/commitdiff
Follow-up fix to r348811 for null Errors (which is the case for end iterators)
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 11 Dec 2018 00:17:36 +0000 (00:17 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 11 Dec 2018 00:17:36 +0000 (00:17 +0000)
Not sure how I missed that in my testing, but obvious enough - this
causes segfaults when attempting to dereference the Error in end
iterators.

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

include/llvm/Object/ELFTypes.h

index c1fadf8e2103134d848abb658b32abd0364cf738..ec3c8e7bae465ba4b788ad2b350ac60679ca5aa1 100644 (file)
@@ -676,9 +676,9 @@ public:
     return *this;
   }
   bool operator==(Elf_Note_Iterator_Impl Other) const {
-    if (!Nhdr)
+    if (!Nhdr && Other.Err)
       (void)(bool)(*Other.Err);
-    if (!Other.Nhdr)
+    if (!Other.Nhdr && Err)
       (void)(bool)(*Err);
     return Nhdr == Other.Nhdr;
   }