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:
Sean Callanan 2011-04-20 00:43:34 +00:00
parent 558692fd0a
commit 863f84648f

View File

@ -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;