mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
[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:
parent
19a3e9aabe
commit
badf4cb75a
@ -1092,7 +1092,6 @@ static int readSIB(struct InternalInstruction* insn) {
|
|||||||
case 2:
|
case 2:
|
||||||
dbgprintf(insn, "SIB-based addressing doesn't work in 16-bit mode");
|
dbgprintf(insn, "SIB-based addressing doesn't work in 16-bit mode");
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
sibIndexBase = SIB_INDEX_EAX;
|
sibIndexBase = SIB_INDEX_EAX;
|
||||||
sibBaseBase = SIB_BASE_EAX;
|
sibBaseBase = SIB_BASE_EAX;
|
||||||
@ -1314,8 +1313,7 @@ static int readModRM(struct InternalInstruction* insn) {
|
|||||||
case 0xc: /* in case REXW.b is set */
|
case 0xc: /* in case REXW.b is set */
|
||||||
insn->eaBase = (insn->addressSize == 4 ?
|
insn->eaBase = (insn->addressSize == 4 ?
|
||||||
EA_BASE_sib : EA_BASE_sib64);
|
EA_BASE_sib : EA_BASE_sib64);
|
||||||
readSIB(insn);
|
if (readSIB(insn) || readDisplacement(insn))
|
||||||
if (readDisplacement(insn))
|
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
case 0x5:
|
case 0x5:
|
||||||
@ -1339,8 +1337,7 @@ static int readModRM(struct InternalInstruction* insn) {
|
|||||||
case 0x4:
|
case 0x4:
|
||||||
case 0xc: /* in case REXW.b is set */
|
case 0xc: /* in case REXW.b is set */
|
||||||
insn->eaBase = EA_BASE_sib;
|
insn->eaBase = EA_BASE_sib;
|
||||||
readSIB(insn);
|
if (readSIB(insn) || readDisplacement(insn))
|
||||||
if (readDisplacement(insn))
|
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user