mips: sanity check for input code length of Mips64

This commit is contained in:
Nguyen Anh Quynh 2015-02-27 17:31:24 +08:00
parent d83bf84cba
commit fbfa06deb7

View File

@ -410,6 +410,14 @@ static DecodeStatus Mips64Disassembler_getInstruction(int mode, MCInst *instr,
{
uint32_t Insn;
if (code_len < 4)
// not enough data
return MCDisassembler_Fail;
if (instr->flat_insn->detail) {
memset(instr->flat_insn->detail, 0, sizeof(cs_detail));
}
DecodeStatus Result = readInstruction32((unsigned char*)code, &Insn, isBigEndian, false);
if (Result == MCDisassembler_Fail)
return MCDisassembler_Fail;