From 2cc0a7da876c1d8c32775b0119e1e15aaa759b9e Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 11 Dec 2018 00:17:36 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348814 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ELFTypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llvm/Object/ELFTypes.h b/include/llvm/Object/ELFTypes.h index c1fadf8e210..ec3c8e7bae4 100644 --- a/include/llvm/Object/ELFTypes.h +++ b/include/llvm/Object/ELFTypes.h @@ -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; } -- 2.50.1