forked from OSchip/llvm-project
[SystemZ] Fix disassembler crashes
The "Size" value returned by SystemZDisassembler::getInstruction is used by common code even in the case where the routine returns failure. If that Size value exceeds the number of bytes remaining in the section, that could cause disassembler crashes. Fixed by never returning more than the number of bytes remaining.
This commit is contained in:
parent
991e86156c
commit
c299f3555d
|
@ -468,8 +468,10 @@ DecodeStatus SystemZDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
|
|||
}
|
||||
|
||||
// Read any remaining bytes.
|
||||
if (Bytes.size() < Size)
|
||||
if (Bytes.size() < Size) {
|
||||
Size = Bytes.size();
|
||||
return MCDisassembler::Fail;
|
||||
}
|
||||
|
||||
// Construct the instruction.
|
||||
uint64_t Inst = 0;
|
||||
|
|
Loading…
Reference in New Issue