cd9d16
From 1add57cd4c48d9eb6517f685f67480b4f4f3f13b Mon Sep 17 00:00:00 2001
cd9d16
From: Markus Armbruster <armbru@redhat.com>
cd9d16
Date: Fri, 4 Nov 2011 10:38:29 +0100
cd9d16
Subject: [PATCH] console: Fix rendering of VGA underline
cd9d16
MIME-Version: 1.0
cd9d16
Content-Type: text/plain; charset=UTF-8
cd9d16
Content-Transfer-Encoding: 8bit
cd9d16
cd9d16
vga_putcharxy()'s underline code sets font_data to 0xffff instead of
cd9d16
0xff.  vga_putcharxy() then reads dmask16[0xffff >> 4] and
cd9d16
dmask4[0xffff >> 6].  In practice, these out-of-bounds subscripts
cd9d16
"only" put a few crap bits into the display surface.
cd9d16
cd9d16
For 32 bit pixels, there's no array access.  font_data's extra bits go
cd9d16
straight into the display surface.
cd9d16
cd9d16
Broken when commit 6d6f7c28 implemented underline.
cd9d16
cd9d16
Spotted by Coverity.
cd9d16
cd9d16
Signed-off-by: Markus Armbruster <armbru@redhat.com>
cd9d16
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cd9d16
(cherry picked from commit 439229c7cb97f6c4cddd3965c3e9d2b8319fe83c)
cd9d16
cd9d16
Signed-off-by: Bruce Rogers <brogers@suse.com>
cd9d16
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d16
---
cd9d16
 console.c | 6 +++---
cd9d16
 1 file changed, 3 insertions(+), 3 deletions(-)
cd9d16
cd9d16
diff --git a/console.c b/console.c
cd9d16
index 242086c..07c82b8 100644
cd9d16
--- a/console.c
cd9d16
+++ b/console.c
cd9d16
@@ -461,7 +461,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,
cd9d16
             font_data = *font_ptr++;
cd9d16
             if (t_attrib->uline
cd9d16
                 && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {
cd9d16
-                font_data = 0xFFFF;
cd9d16
+                font_data = 0xFF;
cd9d16
             }
cd9d16
             ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;
cd9d16
             ((uint32_t *)d)[1] = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
cd9d16
@@ -474,7 +474,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,
cd9d16
             font_data = *font_ptr++;
cd9d16
             if (t_attrib->uline
cd9d16
                 && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {
cd9d16
-                font_data = 0xFFFF;
cd9d16
+                font_data = 0xFF;
cd9d16
             }
cd9d16
             ((uint32_t *)d)[0] = (dmask4[(font_data >> 6)] & xorcol) ^ bgcol;
cd9d16
             ((uint32_t *)d)[1] = (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol;
cd9d16
@@ -487,7 +487,7 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,
cd9d16
         for(i = 0; i < FONT_HEIGHT; i++) {
cd9d16
             font_data = *font_ptr++;
cd9d16
             if (t_attrib->uline && ((i == FONT_HEIGHT - 2) || (i == FONT_HEIGHT - 3))) {
cd9d16
-                font_data = 0xFFFF;
cd9d16
+                font_data = 0xFF;
cd9d16
             }
cd9d16
             ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
cd9d16
             ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;
cd9d16
-- 
cd9d16
1.7.11.2
cd9d16