aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Webb <chris@arachsys.com>2010-03-08 14:34:49 +0000
committerAurelien Jarno <aurelien@aurel32.net>2010-04-11 13:34:43 +0200
commit09e96924ec55eb0f1288ac44b271261055ed0657 (patch)
tree4acd64e3dd7b55ee24707aedb055c1bc41be8dcf
parentnet: remove broken net_set_boot_mask() boot device validation (diff)
downloadqemu-kvm-09e96924ec55eb0f1288ac44b271261055ed0657.tar.gz
qemu-kvm-09e96924ec55eb0f1288ac44b271261055ed0657.tar.bz2
qemu-kvm-09e96924ec55eb0f1288ac44b271261055ed0657.zip
Fix SIGFPE for vnc display of width/height = 1
During boot, the screen gets resized to height 1 and a mouse click at this point will cause a division by zero when calculating the absolute pointer position from the pixel (x, y). Return a click in the middle of the screen instead in this case. Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit cc39a92cbfc80c70d2b83708a4c9b309c3126ac3)
-rw-r--r--vnc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vnc.c b/vnc.c
index a1f9c9293..8566a4ba1 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1421,8 +1421,10 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y)
dz = 1;
if (vs->absolute) {
- kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
- y * 0x7FFF / (ds_get_height(vs->ds) - 1),
+ kbd_mouse_event(ds_get_width(vs->ds) > 1 ?
+ x * 0x7FFF / (ds_get_width(vs->ds) - 1) : 0x4000,
+ ds_get_height(vs->ds) > 1 ?
+ y * 0x7FFF / (ds_get_height(vs->ds) - 1) : 0x4000,
dz, buttons);
} else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
x -= 0x7FFF;