summaryrefslogtreecommitdiff
path: root/tools/llvm-dwp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2016-05-23 17:59:17 +0000
committerDavid Blaikie <dblaikie@gmail.com>2016-05-23 17:59:17 +0000
commit27665308ffc042d3f58b7e8e5ce57f09ab8b65cc (patch)
tree652c7ca9271258b6db6ff138538028f69b18f231 /tools/llvm-dwp
parent645115fadcf4e814ff7338d086feed8715def01a (diff)
llvm-dwp: More error handling around invalid compressed sections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dwp')
-rw-r--r--tools/llvm-dwp/llvm-dwp.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/llvm-dwp/llvm-dwp.cpp b/tools/llvm-dwp/llvm-dwp.cpp
index b88f0ef37d7..1ce6a14d37b 100644
--- a/tools/llvm-dwp/llvm-dwp.cpp
+++ b/tools/llvm-dwp/llvm-dwp.cpp
@@ -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();
}