mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
x86/hvm: Fix boundary check in hvmemul_insn_fetch()
c/s 0943a03037 added some extra protection for overflowing the emulation
instruction cache, but Coverity points out that boundary condition is off by
one when memcpy()'ing out of the buffer.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
This commit is contained in:
1 parent
a63334ef13
commit
5a992b670b
1 file changed
+2
-2
@@ -958,8 +958,8 @@ int hvmemul_insn_fetch(
|
||||
* Will we overflow insn_buf[]? This shouldn't be able to happen,
|
||||
* which means something went wrong with instruction decoding...
|
||||
*/
|
||||
if ( insn_off > sizeof(hvmemul_ctxt->insn_buf) ||
|
||||
(insn_off + bytes) > sizeof(hvmemul_ctxt->insn_buf) )
|
||||
if ( insn_off >= sizeof(hvmemul_ctxt->insn_buf) ||
|
||||
(insn_off + bytes) >= sizeof(hvmemul_ctxt->insn_buf) )
|
||||
{
|
||||
ASSERT_UNREACHABLE();
|
||||
return X86EMUL_UNHANDLEABLE;
|
||||
|
||||