forked from OSchip/llvm-project
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. llvm-svn: 129840
This commit is contained in:
parent
49f754f423
commit
d897f39797
|
@ -198,15 +198,24 @@ int EDOperand::evaluate(uint64_t &result,
|
|||
default:
|
||||
return -1;
|
||||
case kOperandTypeImmediate:
|
||||
if (!Inst.Inst->getOperand(MCOpIndex).isImm())
|
||||
return -1;
|
||||
|
||||
result = Inst.Inst->getOperand(MCOpIndex).getImm();
|
||||
return 0;
|
||||
case kOperandTypeRegister:
|
||||
{
|
||||
if (!Inst.Inst->getOperand(MCOpIndex).isReg())
|
||||
return -1;
|
||||
|
||||
unsigned reg = Inst.Inst->getOperand(MCOpIndex).getReg();
|
||||
return callback(&result, reg, arg);
|
||||
}
|
||||
case kOperandTypeARMBranchTarget:
|
||||
{
|
||||
if (!Inst.Inst->getOperand(MCOpIndex).isImm())
|
||||
return -1;
|
||||
|
||||
int64_t displacement = Inst.Inst->getOperand(MCOpIndex).getImm();
|
||||
|
||||
uint64_t pcVal;
|
||||
|
|
Loading…
Reference in New Issue