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:
parent
17cf37684e
commit
b01b833a5e
BIN
test/tools/llvm-dwp/Inputs/empty_compressed_section.dwo
Normal file
BIN
test/tools/llvm-dwp/Inputs/empty_compressed_section.dwo
Normal file
Binary file not shown.
BIN
test/tools/llvm-dwp/Inputs/invalid_compressed.dwo
Normal file
BIN
test/tools/llvm-dwp/Inputs/invalid_compressed.dwo
Normal file
Binary file not shown.
@ -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'
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user