From nobody Fri May 3 08:57:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558948417; cv=none; d=zoho.com; s=zohoarc; b=CPLKw2u9FEjttxJpgB6jO9gnYpg50O/soPYlTbJMI8gw1GdGDE8/zqubLhPtTC5DupEaaarsedl8LYBK89JEzQQh65VhLyiHg/4FO7CWMrtxE8nRAPSyjMPiSam/xHF+K0TTelAqvmwmkTfL1FpR11IhSVWmwbqTKQb+EQVrejI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558948417; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=w07jwD8gBMW04I1TT34vTEEj3q/bg39sx/ASHdC66c8=; b=ggfudMyp1Vdzea9ojPPYxUu+4Yh3oGThfoNF+Z1DnpwHRKvzXd2TRCTjWWnBGjPPgAYXThfFX3KYK6SKViSORbjgyIqTM4PX0g8atl6rJKzHCK2bmS+aR0H3hOBhTnCRLH8DdNCeWho6ma1aip6PazFGy5bA7NPKs+78cgF6hhg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558948417652247.67093531823662; Mon, 27 May 2019 02:13:37 -0700 (PDT) Received: from localhost ([127.0.0.1]:42389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVBhD-00087A-GF for importer@patchew.org; Mon, 27 May 2019 05:13:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVBgM-0007qb-Jr for qemu-devel@nongnu.org; Mon, 27 May 2019 05:12:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVBgL-0005xR-QS for qemu-devel@nongnu.org; Mon, 27 May 2019 05:12:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVBgL-0005x9-MG for qemu-devel@nongnu.org; Mon, 27 May 2019 05:12:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDE933082B15; Mon, 27 May 2019 09:12:36 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2724D5D704; Mon, 27 May 2019 09:12:32 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 659D616E1A; Mon, 27 May 2019 11:12:26 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 27 May 2019 11:12:26 +0200 Message-Id: <20190527091226.4943-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 27 May 2019 09:12:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] virtio-gpu: add sanity check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Gerd Hoffmann , tslabinski@slabity.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Require a minimum 16x16 size for the scanout, to make sure the guest can't set either width or height to zero. This (a) doesn't make sense at all and (b) causes problems in some UI code. When using spice this will triggers an assert(). Reported-by: Tyler Slabinski Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/display/virtio-gpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 9e37e0ac96b7..372b31ef0af2 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -677,6 +677,8 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, =20 if (ss.r.x > res->width || ss.r.y > res->height || + ss.r.width < 16 || + ss.r.height < 16 || ss.r.width > res->width || ss.r.height > res->height || ss.r.x + ss.r.width > res->width || --=20 2.18.1