[PowerPC] Don't crash when disassembling invalid immediate
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 2 Feb 2023 18:38:08 +0000 (12:38 -0600)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 2 Feb 2023 18:39:49 +0000 (12:39 -0600)
commitc86f8d4276aee8956711829e49c9969cd0223590
tree88c21f5ee859530d5a6ee1686f87a991dda21a6c
parent089bfedfb828c2675f3cc57d6ecac1a87ca243a1
[PowerPC] Don't crash when disassembling invalid immediate

There is an assert in the disassembler functions to ensure
that the immediate is the appropriate width. However,
sometimes what is being disassembled is not instructions
but data that happens to have the bit pattern of an existing
instruction but invalid operands. It is valid for such
things to exist in the text section so we don't want
to crash when disassembling such a thing.

This patch removes the asserts and produces a disassembler
failure for such cases.
llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
llvm/lib/Target/PowerPC/PPCRegisterInfo.td
llvm/test/MC/Disassembler/PowerPC/ppc64-encoding-ISA31-invalid.txt