]> code.ossystems Code Review - openembedded-core.git/commitdiff
QEMU: Fix the mouse shadow issue (bug 170)
authorYu Ke <ke.yu@intel.com>
Wed, 15 Sep 2010 06:42:05 +0000 (14:42 +0800)
committerSaul Wold <Saul.Wold@intel.com>
Mon, 27 Sep 2010 15:59:16 +0000 (08:59 -0700)
the root cause is that the qemu cursor array is hardcoded to 256 bytes, while the sato use cursor of the size 64*64=4096, thus lead buffer overflow and abnormal mouse.

A qemu patch is introduced to dynamically allocate qemu cursor array to fix this issue. BTW, qemu upstream already redesign the cursor interface and implementation, and this issue does not occur in upstream, so no need to push this patch to upstream. and when upgrade the qemu, this patch can be safely removed.

Fix [BUGID #170]

Signed-off-by: Yu Ke <ke.yu@intel.com>
meta/recipes-devtools/qemu/qemu-0.12.4/cursor-shadow-fix.patch [new file with mode: 0644]
meta/recipes-devtools/qemu/qemu_0.12.4.bb

diff --git a/meta/recipes-devtools/qemu/qemu-0.12.4/cursor-shadow-fix.patch b/meta/recipes-devtools/qemu/qemu-0.12.4/cursor-shadow-fix.patch
new file mode 100644 (file)
index 0000000..6600c43
--- /dev/null
@@ -0,0 +1,35 @@
+Fix the mouse shadow in qemu
+
+the root cause is that the qemu cursor array is hardcoded to 256 bytes, while the sato use cursor of the size 64*64=4096, thus lead buffer overflow and abnormal mouse.
+
+This issue has been fixed in upstream starting from v0.13.0-rc0. v0.12.5 still has this issue. So when qemu is upgraded to 0.13.0 or above, this patch can be safely removed.
+
+Signed-off-by: Yu Ke <ke.yu@intel.com>
+
+diff --git a/sdl.c b/sdl.c
+index 7912c91..2f33cd2 100644
+--- a/sdl.c
++++ b/sdl.c
+@@ -775,12 +775,12 @@ static void sdl_mouse_define(int width, int height, int bpp,
+                              int hot_x, int hot_y,
+                              uint8_t *image, uint8_t *mask)
+ {
+-    uint8_t sprite[256], *line;
++    uint8_t *sprite, *line;
+     int x, y, dst, bypl, src = 0;
+     if (guest_sprite)
+         SDL_FreeCursor(guest_sprite);
+-    memset(sprite, 0, 256);
++    sprite = (uint8_t*)qemu_mallocz(width * height);
+     bypl = ((width * bpp + 31) >> 5) << 2;
+     for (y = 0, dst = 0; y < height; y ++, image += bypl) {
+         line = image;
+@@ -818,6 +818,7 @@ static void sdl_mouse_define(int width, int height, int bpp,
+     if (guest_cursor &&
+             (gui_grab || kbd_mouse_is_absolute() || absolute_enabled))
+         SDL_SetCursor(guest_sprite);
++      qemu_free(sprite);
+ }
+ static void sdl_cleanup(void)
index e448eb9b170f61d5ec324e226024b50235007c91..86e6561e1113255f0088172f809f060c0edbd55e 100644 (file)
@@ -1,6 +1,6 @@
 require qemu.inc
 
-PR = "r20"
+PR = "r21"
 
 FILESPATH = "${FILE_DIRNAME}/qemu-${PV}"
 FILESDIR = "${WORKDIR}"
@@ -19,6 +19,7 @@ SRC_URI = "\
     file://qemu-ppc-hack.patch \
     file://enable-i386-linux-user.patch \
     file://arm-cp15-fix.patch \
+    file://cursor-shadow-fix.patch \
     file://powerpc_rom.bin"
 
 do_install_append () {