qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] cirrus_vga: fix off-by-one in blit_region_is_unsafe
@ 2016-02-09 10:59 Paolo Bonzini
  2016-02-09 19:08 ` Laszlo Ersek
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2016-02-09 10:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The "max" value is being compared with >=, but addr + width points to
the first byte that will _not_ be copied.  Subtract one like it is
already done above for the height.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/display/cirrus_vga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index b6ce1c8..e7939d2 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -275,14 +275,14 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
         int64_t min = addr
             + ((int64_t)s->cirrus_blt_height-1) * pitch;
         int32_t max = addr
-            + s->cirrus_blt_width;
+            + s->cirrus_blt_width-1;
         if (min < 0 || max >= s->vga.vram_size) {
             return true;
         }
     } else {
         int64_t max = addr
             + ((int64_t)s->cirrus_blt_height-1) * pitch
-            + s->cirrus_blt_width;
+            + s->cirrus_blt_width-1;
         if (max >= s->vga.vram_size) {
             return true;
         }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-10 16:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 10:59 [Qemu-devel] [PATCH] cirrus_vga: fix off-by-one in blit_region_is_unsafe Paolo Bonzini
2016-02-09 19:08 ` Laszlo Ersek
2016-02-10 12:32   ` Paolo Bonzini
2016-02-10 14:55     ` Laszlo Ersek
2016-02-10 15:29       ` Paolo Bonzini
2016-02-10 15:54         ` Laszlo Ersek
2016-02-10 16:15           ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).