[PATCH] D32466: [llvm-objdump] Don't attempt to print lines beyond the end of file

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 21:27:23 PDT 2017


davide added a comment.

In https://reviews.llvm.org/D32466#736301, @phosek wrote:

> Is it fine to check-in executable? I saw that there're couple already in Inputs for llvm-objdump tests. I'm struggling to reproduce this with just pure llvm-mc and llvm-objdump, but I have a minimal reproducer that works with Clang and produces tiny (1.6k) ELF binary. The problems is that lines in `LineBuffer` are stored in `std::vector` which is allocated in chunks, so even if the debug info points beyond the end of the file, say line 15 in a file which has 14 lines (that typically happens because of comments), this still wouldn't segfault because the vector will have 16 items, but if you can make it point to line 17, it'll segfault (which is what my reproducer does).


As long as it's small, fine. Ideally you might want to not check in binaries, if possible.
If you're having hard time reducing with `llvm-mc`, you may want to consider using `obj2yaml` and `yaml2obj` (having a text representation is better than having a binary).
If the yaml file fails, then check in a binary, but please add instructions (maybe in a comment) on how to regenerate the file in future (in case we need to).
BTW, is this a valid input?


Repository:
  rL LLVM

https://reviews.llvm.org/D32466





More information about the llvm-commits mailing list