All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] cirrus: fix oob access issue
@ 2017-01-24  9:34 Li Qiang
  2017-01-24  9:50 ` no-reply
  2017-01-24 10:23 ` Laszlo Ersek
  0 siblings, 2 replies; 15+ messages in thread
From: Li Qiang @ 2017-01-24  9:34 UTC (permalink / raw)
  To: qemu-devel, ghoffman; +Cc: liqiang6-s

From: Li Qiang <liqiang6-s@360.cn>

When doing bitblt copy in backward mode, minus the blt width first
to avoid an oob access issue.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/display/cirrus_vga.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 379910d..7ddd289 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -277,7 +277,8 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
     }
     if (pitch < 0) {
         int64_t min = addr
-            + ((int64_t)s->cirrus_blt_height-1) * pitch;
+            + ((int64_t)s->cirrus_blt_height-1) * pitch
+            - s->cirrus_blt_width;
         int32_t max = addr
             + s->cirrus_blt_width;
         if (min < 0 || max > s->vga.vram_size) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH] cirrus: fix oob access issue
@ 2017-01-24  9:58 Li Qiang
  0 siblings, 0 replies; 15+ messages in thread
From: Li Qiang @ 2017-01-24  9:58 UTC (permalink / raw)
  To: kraxel, qemu-devel; +Cc: liqiang6-s

From: Li Qiang <liqiang6-s@360.cn>

When doing bitblt copy in backward mode, we should minus the
blt width first just like the adding in the forward mode. This
can avoid the oob access of the front of vga's vram.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
 hw/display/cirrus_vga.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 379910d..fa56730 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -277,7 +277,8 @@ static bool blit_region_is_unsafe(struct CirrusVGAState *s,
     }
     if (pitch < 0) {
         int64_t min = addr
-            + ((int64_t)s->cirrus_blt_height-1) * pitch;
+            + ((int64_t)s->cirrus_blt_height - 1) * pitch
+            - s->cirrus_blt_width;
         int32_t max = addr
             + s->cirrus_blt_width;
         if (min < 0 || max > s->vga.vram_size) {
-- 
1.8.3.1

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

end of thread, other threads:[~2017-01-25 10:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24  9:34 [Qemu-devel] [PATCH] cirrus: fix oob access issue Li Qiang
2017-01-24  9:50 ` no-reply
2017-01-24 10:23 ` Laszlo Ersek
2017-01-24 10:48   ` Gerd Hoffmann
2017-01-24 11:17     ` Laszlo Ersek
2017-01-24 11:24       ` Laszlo Ersek
2017-01-24 12:29       ` Gerd Hoffmann
2017-01-24 15:31         ` Wolfgang Bumiller
2017-01-24 16:12           ` Laszlo Ersek
2017-01-25  1:18             ` Li Qiang
2017-01-25  3:31               ` Laszlo Ersek
2017-01-25  7:26                 ` Gerd Hoffmann
2017-01-25  7:18             ` Gerd Hoffmann
2017-01-25 10:13               ` Laszlo Ersek
2017-01-24  9:58 Li Qiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.