From patchwork Tue Nov 20 09:19:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 200270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 55E142C008F for ; Tue, 20 Nov 2012 20:19:26 +1100 (EST) Received: from localhost ([::1]:60837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TajzI-0001Op-AE for incoming@patchwork.ozlabs.org; Tue, 20 Nov 2012 04:19:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tajz7-0001O8-G9 for qemu-devel@nongnu.org; Tue, 20 Nov 2012 04:19:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tajz1-0004I2-QJ for qemu-devel@nongnu.org; Tue, 20 Nov 2012 04:19:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tajz1-0004GO-HA for qemu-devel@nongnu.org; Tue, 20 Nov 2012 04:19:07 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAK9J56a021025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Nov 2012 04:19:05 -0500 Received: from garlic.redhat.com (vpn-11-35.rdu.redhat.com [10.11.11.35]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qAK9J1tY006362; Tue, 20 Nov 2012 04:19:04 -0500 From: Alon Levy To: qemu-devel@nongnu.org Date: Tue, 20 Nov 2012 11:19:01 +0200 Message-Id: <1353403141-32070-2-git-send-email-alevy@redhat.com> In-Reply-To: <1353403141-32070-1-git-send-email-alevy@redhat.com> References: <1353403141-32070-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [PATCH 2/2] qxl/verify_surface_cmd: check format != 0 (buggy drivers can do that) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Alon Levy --- hw/qxl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/qxl.c b/hw/qxl.c index af5f68e..91e4fec 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -455,6 +455,12 @@ static int verify_surface_cmd(PCIQXLDevice *qxl, QXLSurfaceCmd *cmd) return 1; } } + if (cmd->type == QXL_SURFACE_CMD_CREATE && + cmd->u.surface_create.format == 0) { + qxl_set_guest_bug(qxl, "QXL_CMD_SURFACE invalid format: %u\n", + cmd->u.surface_create.format); + return 1; + } return 0; }