]> Git Repo - qemu.git/commit
m25p80: avoid out of bounds accesses
authorPaolo Bonzini <[email protected]>
Mon, 4 Jul 2016 12:06:37 +0000 (13:06 +0100)
committerPeter Maydell <[email protected]>
Mon, 4 Jul 2016 12:15:22 +0000 (13:15 +0100)
commitb68cb06093a36bd6fbd4d06cd62c08629fea2242
tree0174660ddc51301f91226784843eeaf9678cfe55
parentcace7b801d49430522840fa13e9ac2bdc2dcf941
m25p80: avoid out of bounds accesses

s->cur_addr can be made to point outside s->storage, either by
writing a value >= 128 to s->ear (because s->ear * MAX_3BYTES_SIZE
is a signed integer and sign-extends into the 64-bit cur_addr),
or just by writing an address beyond the size of the flash being
emulated.  Avoid the sign extension to make the code cleaner, and
on top of that mask s->cur_addr to s->size.

Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Message-id: 1467138270[email protected]
Reviewed by: Marcin Krzeminski <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
hw/block/m25p80.c
This page took 0.026625 seconds and 4 git commands to generate.