From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNpPp-0002G9-3q for qemu-devel@nongnu.org; Tue, 08 Nov 2011 12:24:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNpPn-0000N9-UM for qemu-devel@nongnu.org; Tue, 08 Nov 2011 12:24:53 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:34543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNpPn-0000N2-Rh for qemu-devel@nongnu.org; Tue, 08 Nov 2011 12:24:51 -0500 Received: from /spool/local by e3.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Nov 2011 12:24:43 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA8HOGl7270260 for ; Tue, 8 Nov 2011 12:24:17 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pA8HOCBs009373 for ; Tue, 8 Nov 2011 15:24:12 -0200 Message-ID: <4EB965BB.2040109@us.ibm.com> Date: Tue, 08 Nov 2011 11:24:11 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1320399509-28669-1-git-send-email-armbru@redhat.com> In-Reply-To: <1320399509-28669-1-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] console: Fix rendering of VGA underline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On 11/04/2011 04:38 AM, Markus Armbruster wrote: > vga_putcharxy()'s underline code sets font_data to 0xffff instead of > 0xff. vga_putcharxy() then reads dmask16[0xffff>> 4] and > dmask4[0xffff>> 6]. In practice, these out-of-bounds subscripts > "only" put a few crap bits into the display surface. > > For 32 bit pixels, there's no array access. font_data's extra bits go > straight into the display surface. > > Broken when commit 6d6f7c28 implemented underline. > > Spotted by Coverity. > > Signed-off-by: Markus Armbruster Applied. Thanks. Regards, Anthony Liguori > --- > console.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/console.c b/console.c > index e43de92..f6fe441 100644 > --- a/console.c > +++ b/console.c > @@ -467,7 +467,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch, > font_data = *font_ptr++; > if (t_attrib->uline > && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) { > - font_data = 0xFFFF; > + font_data = 0xFF; > } > ((uint32_t *)d)[0] = (dmask16[(font_data>> 4)]& xorcol) ^ bgcol; > ((uint32_t *)d)[1] = (dmask16[(font_data>> 0)& 0xf]& xorcol) ^ bgcol; > @@ -480,7 +480,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch, > font_data = *font_ptr++; > if (t_attrib->uline > && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) { > - font_data = 0xFFFF; > + font_data = 0xFF; > } > ((uint32_t *)d)[0] = (dmask4[(font_data>> 6)]& xorcol) ^ bgcol; > ((uint32_t *)d)[1] = (dmask4[(font_data>> 4)& 3]& xorcol) ^ bgcol; > @@ -493,7 +493,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch, > for(i = 0; i< FONT_HEIGHT; i++) { > font_data = *font_ptr++; > if (t_attrib->uline&& ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) { > - font_data = 0xFFFF; > + font_data = 0xFF; > } > ((uint32_t *)d)[0] = (-((font_data>> 7))& xorcol) ^ bgcol; > ((uint32_t *)d)[1] = (-((font_data>> 6)& 1)& xorcol) ^ bgcol;