qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] vmware_vga: Redraw only visible area


From: Marek Vasut
Subject: [Qemu-devel] [PATCH] vmware_vga: Redraw only visible area
Date: Fri, 17 Aug 2012 04:55:07 +0200

Disallow negative value boundaries of the redraw rectangle.
This fixes a segfault when using -vga vmware.

Signed-off-by: Marek Vasut <address@hidden>
---
 hw/vmware_vga.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

NOTE: I tested this by emulating some recent version of ubuntu. The rect->x
      value was set to -65 for some reason at one point, which caused the
      kvm to crash. Trimming the rectangle fixed the issue.

diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index f5e4f44..62e5887 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -337,8 +337,8 @@ static inline void vmsvga_update_rect_delayed(struct 
vmsvga_state_s *s,
 {
     struct vmsvga_rect_s *rect = &s->redraw_fifo[s->redraw_fifo_last ++];
     s->redraw_fifo_last &= REDRAW_FIFO_LEN - 1;
-    rect->x = x;
-    rect->y = y;
+    rect->x = (x < 0) ? 0 : x;
+    rect->y = (y < 0) ? 0 : y;
     rect->w = w;
     rect->h = h;
 }
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]