]> git.proxmox.com Git - qemu.git/commit
vnc: Fix stack corruption and other bitmap related bugs
authorStefan Weil <weil@mail.berlios.de>
Thu, 3 Mar 2011 20:37:55 +0000 (21:37 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 10 Mar 2011 22:12:25 +0000 (16:12 -0600)
commit23bfe28fffd6fff12a39c1ff7274b0dfdecbfa38
tree9d9e19536b3781019e61e068b33b4e86e960f4d4
parent2ea720dba50a4e95a641dd69b0a9864b315868c2
vnc: Fix stack corruption and other bitmap related bugs

Commit bc2429b9174ac2d3c56b7fd35884b0d89ec7fb02 introduced
a severe bug (stack corruption).

bitmap_clear was called with a wrong argument
which caused out-of-bound writes to the local variable width_mask.

This bug was detected with QEMU running on windows.
It also occurs with wine:

*** stack smashing detected ***:  terminated
wine: Unhandled illegal instruction at address 0x6115c7 (thread 0009), starting debugger...

The bug is not windows specific!

Instead of fixing the wrong parameter value, bitmap_clear(), bitmap_set
and width_mask were removed, and bitmap_intersect() was replaced by
!bitmap_empty(). The new operation is much shorter and equivalent to
the old operations.

The declarations of the dirty bitmaps in vnc.h were also wrong for 64 bit
hosts because of a rounding effect: for these hosts, VNC_MAX_WIDTH is no
longer a multiple of (16 * BITS_PER_LONG), so the rounded value of
VNC_DIRTY_WORDS was too small.

Fix both declarations by using the macro which is designed for this
purpose.

Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Gerhard Wiesinger <lists@wiesinger.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ui/vnc.c
ui/vnc.h