[llvm] r373319 - [obj2yaml] - Fix BB after r373315.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 03:02:47 PDT 2019
Author: grimar
Date: Tue Oct 1 03:02:47 2019
New Revision: 373319
URL: http://llvm.org/viewvc/llvm-project?rev=373319&view=rev
Log:
[obj2yaml] - Fix BB after r373315.
The success return value for data extractor's cursor
should also be checked.
Modified:
llvm/trunk/tools/obj2yaml/elf2yaml.cpp
Modified: llvm/trunk/tools/obj2yaml/elf2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/elf2yaml.cpp?rev=373319&r1=373318&r2=373319&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/elf2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/elf2yaml.cpp Tue Oct 1 03:02:47 2019
@@ -647,7 +647,9 @@ ELFDumper<ELFT>::dumpHashSection(const E
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<ELFT>::dumpHashSection(const E
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 <class ELFT>
More information about the llvm-commits
mailing list