Skip to content
Snippets Groups Projects
Commit 55737084 authored by Daniel Axtens's avatar Daniel Axtens Committed by Julian Andres Klode
Browse files

normal/charset: Fix array out-of-bounds formatting unicode for display


In some cases attempting to display arbitrary binary strings leads
to ASAN splats reading the widthspec array out of bounds.

Check the index. If it would be out of bounds, return a width of 1.
I don't know if that's strictly correct, but we're not really expecting
great display of arbitrary binary data, and it's certainly not worse than
an OOB read.

Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
parent a10c2350
No related branches found
No related tags found
No related merge requests found
......@@ -395,6 +395,8 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c)
{
if (grub_unicode_get_comb_type (c->base))
return 0;
if (((unsigned long) (c->base >> 3)) >= ARRAY_SIZE (widthspec))
return 1;
if (widthspec[c->base >> 3] & (1 << (c->base & 7)))
return 2;
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment