summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/Disassembler
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2012-11-29 23:47:11 +0000
committerKevin Enderby <enderby@apple.com>2012-11-29 23:47:11 +0000
commit1c83093cd5f4f6d33e732c817bb5afd033531beb (patch)
tree4920542d91ab9d5b12cd1e3dc247176edf6a0346 /lib/Target/ARM/Disassembler
parent5cf823cd82778e3193a18feffeee69b2beb92c68 (diff)
downloadllvm-1c83093cd5f4f6d33e732c817bb5afd033531beb.tar.gz
llvm-1c83093cd5f4f6d33e732c817bb5afd033531beb.tar.bz2
llvm-1c83093cd5f4f6d33e732c817bb5afd033531beb.tar.xz
Fixed the arm disassembly of invalid BFI instructions to not build a bad MCInst
which would then cause an assert when printed. rdar://11437956 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/Disassembler')
-rw-r--r--lib/Target/ARM/Disassembler/ARMDisassembler.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
index f00142de50..5de50d592e 100644
--- a/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
+++ b/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
@@ -1281,7 +1281,13 @@ static DecodeStatus DecodeBitfieldMaskOperand(MCInst &Inst, unsigned Val,
unsigned lsb = fieldFromInstruction(Val, 0, 5);
DecodeStatus S = MCDisassembler::Success;
- if (lsb > msb) Check(S, MCDisassembler::SoftFail);
+ if (lsb > msb) {
+ Check(S, MCDisassembler::SoftFail);
+ // The check above will cause the warning for the "potentially undefined
+ // instruction encoding" but we can't build a bad MCOperand value here
+ // with a lsb > msb or else printing the MCInst will cause a crash.
+ lsb = msb;
+ }
uint32_t msb_mask = 0xFFFFFFFF;
if (msb != 31) msb_mask = (1U << (msb+1)) - 1;