[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 01:16:51 PDT 2017
grimar added inline comments.
================
Comment at: lib/Object/Decompressor.cpp:98-100
+ errs() << "Decompression failed: unable to allocate "
+ << *static_cast<uint64_t *>(SizePtr) << " bytes.\n";
+ exit(1);
----------------
davide wrote:
> fatal?
Thanks for using `report_fatal_error` here, it is correct I belive because implementation of `llvm::report_bad_alloc_error` explicitly expects handler does not return.
================
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 failed: unable to allocate 2314885530818453536 bytes.
----------------
Would be nice to include some additional information here.
At least decompressor currently can know about section name,
probably something like:
`Decompression of '.section_name_here' failed: unable to allocate 2314885530818453536 bytes.` ?
Repository:
rL LLVM
https://reviews.llvm.org/D37447
More information about the llvm-commits
mailing list