aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Object/Decompressor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Object/Decompressor.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Object/Decompressor.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/contrib/llvm-project/llvm/lib/Object/Decompressor.cpp b/contrib/llvm-project/llvm/lib/Object/Decompressor.cpp
index 11efd857d1a1..ec15e6f69ada 100644
--- a/contrib/llvm-project/llvm/lib/Object/Decompressor.cpp
+++ b/contrib/llvm-project/llvm/lib/Object/Decompressor.cpp
@@ -56,7 +56,7 @@ Error Decompressor::consumeCompressedZLibHeader(bool Is64Bit,
return createError("corrupted compressed section header");
DataExtractor Extractor(SectionData, IsLittleEndian, 0);
- uint64_t Offset = 0;
+ uint32_t Offset = 0;
if (Extractor.getUnsigned(&Offset, Is64Bit ? sizeof(Elf64_Word)
: sizeof(Elf32_Word)) !=
ELFCOMPRESS_ZLIB)
@@ -77,15 +77,10 @@ bool Decompressor::isGnuStyle(StringRef Name) {
}
bool Decompressor::isCompressed(const object::SectionRef &Section) {
- if (Section.isCompressed())
- return true;
-
- Expected<StringRef> SecNameOrErr = Section.getName();
- if (SecNameOrErr)
- return isGnuStyle(*SecNameOrErr);
-
- consumeError(SecNameOrErr.takeError());
- return false;
+ StringRef Name;
+ if (Section.getName(Name))
+ return false;
+ return Section.isCompressed() || isGnuStyle(Name);
}
bool Decompressor::isCompressedELFSection(uint64_t Flags, StringRef Name) {