qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] console: Fix rendering of VGA underline
Date: Tue, 08 Nov 2011 11:24:11 -0600	[thread overview]
Message-ID: <4EB965BB.2040109@us.ibm.com> (raw)
In-Reply-To: <1320399509-28669-1-git-send-email-armbru@redhat.com>

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<armbru@redhat.com>

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;

      reply	other threads:[~2011-11-08 17:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-04  9:38 [Qemu-devel] [PATCH] console: Fix rendering of VGA underline Markus Armbruster
2011-11-08 17:24 ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EB965BB.2040109@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).