From: George Rimar Date: Tue, 1 Oct 2019 10:02:47 +0000 (+0000) Subject: [obj2yaml] - Fix BB after r373315. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92af9a3676ffafb371e5c7d79da07ce841d648ed;p=llvm [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 --- 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