[X86] Check return value of readSIB in disassembler so errors propagate. In particular this makes a too short instruction with a missing SIB byte fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204305 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2014-03-20 05:56:00 +00:00
parent 19a3e9aabe
commit badf4cb75a

View File

@ -1092,7 +1092,6 @@ static int readSIB(struct InternalInstruction* insn) {
case 2:
dbgprintf(insn, "SIB-based addressing doesn't work in 16-bit mode");
return -1;
break;
case 4:
sibIndexBase = SIB_INDEX_EAX;
sibBaseBase = SIB_BASE_EAX;
@ -1314,8 +1313,7 @@ static int readModRM(struct InternalInstruction* insn) {
case 0xc: /* in case REXW.b is set */
insn->eaBase = (insn->addressSize == 4 ?
EA_BASE_sib : EA_BASE_sib64);
readSIB(insn);
if (readDisplacement(insn))
if (readSIB(insn) || readDisplacement(insn))
return -1;
break;
case 0x5:
@ -1339,8 +1337,7 @@ static int readModRM(struct InternalInstruction* insn) {
case 0x4:
case 0xc: /* in case REXW.b is set */
insn->eaBase = EA_BASE_sib;
readSIB(insn);
if (readDisplacement(insn))
if (readSIB(insn) || readDisplacement(insn))
return -1;
break;
default: