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