[U-Boot] [PATCH 1/8] video/console: Fix DM_VIDEO font glyph array indexing

Simon Glass sjg at chromium.org
Sat Mar 30 21:18:39 UTC 2019


Hi Andre,

On Fri, 22 Mar 2019 at 19:32, Andre Przywara <andre.przywara at arm.com> wrote:
>
> When the character to be printed on a DM_VIDEO console is from the
> "extended ASCII" range (0x80 - 0xff), it will be treated as a negative
> number, as it's declared as a signed char. This leads to negative array
> indicies into the glyph bitmap array, and random garbled characters.
>
> Cast the character to an unsigned type to make the index always positive
> and avoid an out-of-bounds access.
>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> ---
>  drivers/video/console_normal.c | 3 ++-
>  drivers/video/console_rotate.c | 7 ++++---
>  2 files changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

Should use u8 instead of uint8_t.

It might make sense to adjust one of the tests to output such a character.

Regards,
Simon


More information about the U-Boot mailing list