[llvm] r348814 - Follow-up fix to r348811 for null Errors (which is the case for end iterators)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 16:17:36 PST 2018


Author: dblaikie
Date: Mon Dec 10 16:17:36 2018
New Revision: 348814

URL: http://llvm.org/viewvc/llvm-project?rev=348814&view=rev
Log:
Follow-up fix to r348811 for null Errors (which is the case for end iterators)

Not sure how I missed that in my testing, but obvious enough - this
causes segfaults when attempting to dereference the Error in end
iterators.

Modified:
    llvm/trunk/include/llvm/Object/ELFTypes.h

Modified: llvm/trunk/include/llvm/Object/ELFTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFTypes.h?rev=348814&r1=348813&r2=348814&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFTypes.h (original)
+++ llvm/trunk/include/llvm/Object/ELFTypes.h Mon Dec 10 16:17:36 2018
@@ -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;
   }




More information about the llvm-commits mailing list