mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[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
22468bc83b
commit
02786e70af
@ -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…
x
Reference in New Issue
Block a user