From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVyeo-0007cM-Qo for qemu-devel@nongnu.org; Tue, 24 Jan 2017 05:48:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVyek-000524-0k for qemu-devel@nongnu.org; Tue, 24 Jan 2017 05:48:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cVyej-000511-QY for qemu-devel@nongnu.org; Tue, 24 Jan 2017 05:48:53 -0500 Message-ID: <1485254930.32716.23.camel@redhat.com> From: Gerd Hoffmann Date: Tue, 24 Jan 2017 11:48:50 +0100 In-Reply-To: <237b1da5-532d-afd6-84ad-6adc5bd97291@redhat.com> References: <58871f9b.d635240a.4cda6.5322@mx.google.com> <237b1da5-532d-afd6-84ad-6adc5bd97291@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] cirrus: fix oob access issue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Li Qiang , qemu-devel@nongnu.org, ghoffman@redhat.com, liqiang6-s@360.cn > > diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c > > index 379910d..7ddd289 100644 > > --- a/hw/display/cirrus_vga.c > > +++ b/hw/display/cirrus_vga.c > > @@ -277,7 +277,8 @@ static bool blit_region_is_unsafe(struct CirrusVGAS= tate *s, > > } > > if (pitch < 0) { > > int64_t min =3D addr > > - + ((int64_t)s->cirrus_blt_height-1) * pitch; > > + + ((int64_t)s->cirrus_blt_height-1) * pitch > > + - s->cirrus_blt_width; > > int32_t max =3D addr > > + s->cirrus_blt_width; > > if (min < 0 || max > s->vga.vram_size) { > >=20 >=20 > I believe this is incorrect. In this case (AFAIR), "addr" points to the > left-most pixel (=3D lowest address) of the bottom line (=3D highest > address). If I read the code correctly it is backwards *both* x and y axis, so addr is the right-most pixel of the bottom line. cheers, Gerd