From nobody Sun May 5 13:46:34 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 ARC-Seal: i=1; a=rsa-sha256; t=1554808139; cv=none; d=zoho.com; s=zohoarc; b=G+2RPNHBglyQozgdQrE0CiAz8vI8vrTn0UnwlG0P9xG30vMCmZMLaQHSXOa2OVv0kQDRcSDHH9GL42RB7q243RoXi30UB9YCaSINeSRVtTSBqWVaQHHeMEpJ4cNQWlLq08d/pVQAV08anO82Z6LkV6cjoO8ZPOvcmBAj54Rr1r0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554808139; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=tq3suttm24s93IDGMLfi9UexllyU0mPCwHAY5YVyu+s=; b=adQ8PJCFgb2Dzp6NH2BHXISA6xthaFXTyKPSpXt0hM/lHXxE3EvuUnFCm2vMv8imk9LQgQjmlI4zjSknSUfhz3rI1MDhywaGJMLpqpt0oth2SdPm7xnb4/bBllkceuYaeNxlxt10y6yUf0ynuqGeLtQWP3Ox4h8zMunvw5thhA8= 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=null header.from= header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554808139334756.4596772367495; Tue, 9 Apr 2019 04:08:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:39200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDocO-0005FV-5l for importer@patchew.org; Tue, 09 Apr 2019 07:08:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDoba-0004wy-1M for qemu-devel@nongnu.org; Tue, 09 Apr 2019 07:07:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDobZ-00078w-4s for qemu-devel@nongnu.org; Tue, 09 Apr 2019 07:07:54 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:28595) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDobY-00071L-Q0 for qemu-devel@nongnu.org; Tue, 09 Apr 2019 07:07:53 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 7DF99746622; Tue, 9 Apr 2019 13:07:32 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5C5FF7465DB; Tue, 9 Apr 2019 13:07:32 +0200 (CEST) From: BALATON Zoltan Date: Tue, 09 Apr 2019 12:56:18 +0200 MIME-Version: 1.0 To: qemu-devel@nongnu.org Message-Id: <20190409110732.5C5FF7465DB@zero.eik.bme.hu> Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:738:2001:2001::2001 Subject: [Qemu-devel] [PATCH] ati-vga: Fix check for blt outside vram 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: Gerd Hoffmann , Andrew Randrianasulu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Fix the check preventing calling pixman functions that would access memory outside allocated vram. The r128 X driver sometimes seem to try blits that span outside vram, this check prevents crashing QEMU in that case. (The r128 X driver may have problems even on real hardware so I'm not sure if it's a client bug or emulation problem but at least QEMU should survive.) Signed-off-by: BALATON Zoltan Tested-by: Andrew Randrianasulu --- hw/display/ati_2d.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c index bc98ba6eeb..fe3ae14864 100644 --- a/hw/display/ati_2d.c +++ b/hw/display/ati_2d.c @@ -79,10 +79,10 @@ void ati_2d_blt(ATIVGAState *s) s->regs.dst_width, s->regs.dst_height); end =3D s->vga.vram_ptr + s->vga.vram_size; if (src_bits >=3D end || dst_bits >=3D end || - src_bits + (s->regs.src_y + s->regs.dst_height) * src_stride + - s->regs.src_x >=3D end || - dst_bits + (s->regs.dst_y + s->regs.dst_height) * dst_stride + - s->regs.dst_x >=3D end) { + src_bits + s->regs.src_x + (s->regs.src_y + s->regs.dst_height= ) * + src_stride * sizeof(uint32_t) >=3D end || + dst_bits + s->regs.dst_x + (s->regs.dst_y + s->regs.dst_height= ) * + dst_stride * sizeof(uint32_t) >=3D end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } @@ -140,8 +140,8 @@ void ati_2d_blt(ATIVGAState *s) filler); end =3D s->vga.vram_ptr + s->vga.vram_size; if (dst_bits >=3D end || - dst_bits + (s->regs.dst_y + s->regs.dst_height) * dst_stride + - s->regs.dst_x >=3D end) { + dst_bits + s->regs.dst_x + (s->regs.dst_y + s->regs.dst_height= ) * + dst_stride * sizeof(uint32_t) >=3D end) { qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); return; } --=20 2.13.7