From 92af9a3676ffafb371e5c7d79da07ce841d648ed Mon Sep 17 00:00:00 2001 From: George Rimar Date: Tue, 1 Oct 2019 10:02:47 +0000 Subject: [PATCH] [obj2yaml] - Fix BB after r373315. The success return value for data extractor's cursor should also be checked. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373319 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/obj2yaml/elf2yaml.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/obj2yaml/elf2yaml.cpp b/tools/obj2yaml/elf2yaml.cpp index b70a5dd0784..c4b6eb79d18 100644 --- a/tools/obj2yaml/elf2yaml.cpp +++ b/tools/obj2yaml/elf2yaml.cpp @@ -647,7 +647,9 @@ ELFDumper::dumpHashSection(const Elf_Shdr *Shdr) { uint32_t NChain = Data.getU32(Cur); if (Content.size() != (2 + NBucket + NChain) * 4) { S->Content = yaml::BinaryRef(Content); - return S.release(); + if (Cur) + return S.release(); + llvm_unreachable("entries were not read correctly"); } S->Bucket.emplace(NBucket); @@ -658,9 +660,9 @@ ELFDumper::dumpHashSection(const Elf_Shdr *Shdr) { for (uint32_t &V : *S->Chain) V = Data.getU32(Cur); - if (!Cur) - llvm_unreachable("entries were not read correctly"); - return S.release(); + if (Cur) + return S.release(); + llvm_unreachable("entries were not read correctly"); } template -- 2.50.1