From nobody Mon Feb 9 12:26:11 2026 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=1557217371; cv=none; d=zoho.com; s=zohoarc; b=fQ6L0mO+BCy0nv+ZqDDJ3fpVjPf8hVM79wGhGKUEiGP1zFI+lbh2QesPeglhweB4VVd6Szlxh9aHQGaNbQY5M19xljk/96j1TakPGMFQBV+nopI2815bCy/wCR0Y/31FHuCN42FjpboD+iU0tDrndRLbV+tdmjDKyDENIUrVygc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557217371; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sF4g5YBTChoqXzlCzbAgoz6oX5cWHotMAiuOzE1YM2c=; b=Qtxz3kIobzewFnSPzwDmz+i3tVin4y3WaAwkFX4BW82o1gFZB9C0ypOYc3n/02AM9QTaDPZxxrjVYDQNdM/Lf2D0DcaltKQA23H//kBZirpoGrXFOdk7yK1njSeBJqsN9WJdzBgrLYTBzv2ri1ibiRkL3o1hHFskbzH0j2hSLzs= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557217371785355.4755418847244; Tue, 7 May 2019 01:22:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:42061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNvNA-0003Dq-Ph for importer@patchew.org; Tue, 07 May 2019 04:22:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNvKP-0000h2-Jd for qemu-devel@nongnu.org; Tue, 07 May 2019 04:19:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNvKO-0008Cu-KI for qemu-devel@nongnu.org; Tue, 07 May 2019 04:19:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hNvKM-0008A7-DX; Tue, 07 May 2019 04:19:54 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A18843082134; Tue, 7 May 2019 08:19:53 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDD39614D6; Tue, 7 May 2019 08:19:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B1C8AA1E9; Tue, 7 May 2019 10:19:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 7 May 2019 10:19:45 +0200 Message-Id: <20190507081946.19264-8-kraxel@redhat.com> In-Reply-To: <20190507081946.19264-1-kraxel@redhat.com> References: <20190507081946.19264-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 07 May 2019 08:19:53 +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] [PULL 7/8] 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: Peter Maydell , Alistair Francis , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Gerd Hoffmann , "Edgar E. Iglesias" , Paolo Bonzini 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" From: BALATON Zoltan 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 Message-Id: <20190409110732.5C5FF7465DB@zero.eik.bme.hu> Signed-off-by: Gerd Hoffmann --- 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 bc98ba6eebf6..fe3ae148647b 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.18.1