[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-xen-unstable] console: Avoid overrunning the dmask arrays
commit ec5080d57c87e1ace8d76e12261ce660594516f8 Author: Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx> AuthorDate: Fri Mar 7 15:11:21 2014 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Oct 16 16:52:06 2015 +0100 console: Avoid overrunning the dmask arrays The valide range of font_data should be [0, 0xFF]. Signed-off-by: Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx> (defects not identified by Coverity Scan) Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- console.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/console.c b/console.c index 9984d6f..d4f1ad0 100644 --- a/console.c +++ b/console.c @@ -421,7 +421,8 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch, { uint8_t *d; const uint8_t *font_ptr; - unsigned int font_data, linesize, xorcol, bpp; + uint8_t font_data; + unsigned int linesize, xorcol, bpp; int i; unsigned int fgcol, bgcol; @@ -450,7 +451,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; @@ -463,7 +464,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; @@ -476,7 +477,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; -- generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |