[PATCH] D37447: [Decompression] Fail gracefully when out of memory

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 02:23:02 PDT 2017


grimar added a comment.

I prepared a better binary, you can take it here:
https://drive.google.com/open?id=0B_OWr6ld9gUmZ3lqMkUzcThvd1E
(with that error message will contain proper section name).

It is prepared using following source code and invocation:
test.cpp:
int main() { return 0; }

gcc test.cpp -o out -g -Wl,--compress-debug-sections,zlib

After that result object was modified manually. 
Decompressed size of .debug_frame section was changed to 0xffffffffffffffff in 
compression header.

Please include this information into testcase. We usually do that for testcases,
which uses precompiled binary 
(see llvm\test\DebugInfo\dwarfdump-decompression-error.test for example)



================
Comment at: include/llvm/Object/Decompressor.h:46
+  /// @brief Return name of the section that is being decompressed.
+  StringRef getSectionName() { return SectionData; }
+
----------------
You do not need this getter, you can access to `SectionName` directly from handler as it is a static member function.


================
Comment at: test/tools/llvm-dwarfdump/dwarf-invalid-compression.test:2
+RUN: not llvm-dwarfdump %p/Inputs/dwarf-invalid-compression 2>&1 | FileCheck %s
+CHECK: Decompression of ' ' failed: unable to allocate 2314885530818453536 bytes.
----------------
Decompression -> decompression
(error messages starts from lowercase)


Repository:
  rL LLVM

https://reviews.llvm.org/D37447





More information about the llvm-commits mailing list