1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

llvm-dwp: More error handling around invalid compressed sections

llvm-svn: 270466
This commit is contained in:
David Blaikie 2016-05-23 17:59:17 +00:00
parent 17cf37684e
commit b01b833a5e
4 changed files with 7 additions and 8 deletions

Binary file not shown.

View File

@ -1,5 +1,7 @@
RUN: not llvm-dwp %p/../Inputs/compressfail/a.dwo -o %t 2>&1 | FileCheck %s
RUN: not llvm-dwp %p/../Inputs/empty_compressed_section.dwo -o %t 2>&1 | FileCheck %s
RUN: not llvm-dwp %p/../Inputs/invalid_compressed.dwo -o %t 2>&1 | FileCheck %s
REQUIRES: zlib
CHECK: error: failure while decompressing compressed section: 'zdebug_info.dwo'
CHECK: error: failure while decompressing compressed section: 'zdebug_{{.*}}.dwo'

View File

@ -432,20 +432,17 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
return errorCodeToError(Err);
if (Name.startswith("zdebug_")) {
UncompressedSections.emplace_back();
uint64_t OriginalSize;
if (!zlib::isAvailable())
return make_error<DWPError>("zlib not available");
if (!consumeCompressedDebugSectionHeader(Contents, OriginalSize))
if (!consumeCompressedDebugSectionHeader(Contents, OriginalSize) ||
zlib::uncompress(Contents, UncompressedSections.back(),
OriginalSize) != zlib::StatusOK)
return make_error<DWPError>(
("failure while decompressing compressed section: '" + Name +
"\'")
.str());
UncompressedSections.resize(UncompressedSections.size() + 1);
if (zlib::uncompress(Contents, UncompressedSections.back(),
OriginalSize) != zlib::StatusOK) {
UncompressedSections.pop_back();
continue;
}
Name = Name.substr(1);
Contents = UncompressedSections.back();
}