mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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>
This commit is contained in:
parent
3c9c706c3b
commit
cc39a92cbf
1 changed files with 4 additions and 2 deletions
6
vnc.c
6
vnc.c
|
@ -1457,8 +1457,10 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y)
|
||||||
dz = 1;
|
dz = 1;
|
||||||
|
|
||||||
if (vs->absolute) {
|
if (vs->absolute) {
|
||||||
kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
|
kbd_mouse_event(ds_get_width(vs->ds) > 1 ?
|
||||||
y * 0x7FFF / (ds_get_height(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);
|
dz, buttons);
|
||||||
} else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
|
} else if (vnc_has_feature(vs, VNC_FEATURE_POINTER_TYPE_CHANGE)) {
|
||||||
x -= 0x7FFF;
|
x -= 0x7FFF;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue