From patchwork Mon Mar 8 14:34:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Webb X-Patchwork-Id: 84060 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o28EZBqb017711 for ; Mon, 8 Mar 2010 14:35:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755187Ab0CHOex (ORCPT ); Mon, 8 Mar 2010 09:34:53 -0500 Received: from alpha.arachsys.com ([91.203.57.7]:44173 "EHLO alpha.arachsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754425Ab0CHOew (ORCPT ); Mon, 8 Mar 2010 09:34:52 -0500 Received: from [83.104.159.199] (helo=miranda.arachsys.com) by alpha.arachsys.com with esmtpa (Exim 4.52) id 1Noe2l-0003gc-4T; Mon, 08 Mar 2010 14:34:51 +0000 Received: from chris by miranda.arachsys.com with local (Exim 4.52) id 1Noe2j-00014i-Tg; Mon, 08 Mar 2010 14:34:49 +0000 Date: Mon, 8 Mar 2010 14:34:49 +0000 From: Chris Webb To: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [PATCH] Fix SIGFPE for vnc display of width/height = 1 Message-ID: <20100308143449.GA4084@arachsys.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100306085332.GF7180@arachsys.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 08 Mar 2010 14:35:11 +0000 (UTC) diff --git a/vnc.c b/vnc.c index 01353a9..676a707 100644 --- a/vnc.c +++ b/vnc.c @@ -1457,8 +1457,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;