mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Made the MC disassembler check before accessing
MCInst operands for ARM. This allows it to be more tolerant of malformed MCInsts or incorrect instruction metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129840 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -198,15 +198,24 @@ int EDOperand::evaluate(uint64_t &result,
|
|||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
case kOperandTypeImmediate:
|
case kOperandTypeImmediate:
|
||||||
|
if (!Inst.Inst->getOperand(MCOpIndex).isImm())
|
||||||
|
return -1;
|
||||||
|
|
||||||
result = Inst.Inst->getOperand(MCOpIndex).getImm();
|
result = Inst.Inst->getOperand(MCOpIndex).getImm();
|
||||||
return 0;
|
return 0;
|
||||||
case kOperandTypeRegister:
|
case kOperandTypeRegister:
|
||||||
{
|
{
|
||||||
|
if (!Inst.Inst->getOperand(MCOpIndex).isReg())
|
||||||
|
return -1;
|
||||||
|
|
||||||
unsigned reg = Inst.Inst->getOperand(MCOpIndex).getReg();
|
unsigned reg = Inst.Inst->getOperand(MCOpIndex).getReg();
|
||||||
return callback(&result, reg, arg);
|
return callback(&result, reg, arg);
|
||||||
}
|
}
|
||||||
case kOperandTypeARMBranchTarget:
|
case kOperandTypeARMBranchTarget:
|
||||||
{
|
{
|
||||||
|
if (!Inst.Inst->getOperand(MCOpIndex).isImm())
|
||||||
|
return -1;
|
||||||
|
|
||||||
int64_t displacement = Inst.Inst->getOperand(MCOpIndex).getImm();
|
int64_t displacement = Inst.Inst->getOperand(MCOpIndex).getImm();
|
||||||
|
|
||||||
uint64_t pcVal;
|
uint64_t pcVal;
|
||||||
|
Reference in New Issue
Block a user