[llvm] r204305 - [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.
Craig Topper
craig.topper at gmail.com
Wed Mar 19 22:56:01 PDT 2014
Author: ctopper
Date: Thu Mar 20 00:56:00 2014
New Revision: 204305
URL: http://llvm.org/viewvc/llvm-project?rev=204305&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=204305&r1=204304&r2=204305&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original)
+++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Thu Mar 20 00:56:00 2014
@@ -1092,7 +1092,6 @@ static int readSIB(struct InternalInstru
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 InternalInst
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 InternalInst
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:
More information about the llvm-commits
mailing list