[PATCH] D73531: [llvm-objdump] avoid crash disassembling unknown instruction

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 01:45:20 PST 2020


jhenderson added a comment.

Testing this should be possible as suggested by @grimar, by creating a small text section using yaml2obj with explicit instructions that mimic the reproducible. I'm guessing you might need to have an odd number of bytes, but I'm not sure. If that doesn't do it on its own, you may need to dig into the crash point to identify where exactly the crash is occurring, and what inputs are needed to trigger it.



================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:1434
 
+        if (!Disassembled) {
+          outs() << "\n";
----------------
Let's add a comment here explaining why we don't just let it fall through to the following code. Something like "Continue early, if the disassembler failed to decode the instruction, so that llvm-objdump doesn't try to load other information for that instruction, which may be invalid or incomplete." Happy for alternative suggestions though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73531/new/

https://reviews.llvm.org/D73531





More information about the llvm-commits mailing list