|
|
a9bbe0 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
a9bbe0 |
From: Zhang Boyang <zhangboyang.id@gmail.com>
|
|
|
a9bbe0 |
Date: Fri, 28 Oct 2022 17:29:16 +0800
|
|
|
a9bbe0 |
Subject: [PATCH] font: Assign null_font to glyphs in ascii_font_glyph[]
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
The calculations in blit_comb() need information from glyph's font, e.g.
|
|
|
a9bbe0 |
grub_font_get_xheight(main_glyph->font). However, main_glyph->font is
|
|
|
a9bbe0 |
NULL if main_glyph comes from ascii_font_glyph[]. Therefore
|
|
|
a9bbe0 |
grub_font_get_*() crashes because of NULL pointer.
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
There is already a solution, the null_font. So, assign it to those glyphs
|
|
|
a9bbe0 |
in ascii_font_glyph[].
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
Reported-by: Daniel Axtens <dja@axtens.net>
|
|
|
a9bbe0 |
Signed-off-by: Zhang Boyang <zhangboyang.id@gmail.com>
|
|
|
a9bbe0 |
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
a9bbe0 |
(cherry picked from commit dd539d695482069d28b40f2d3821f710cdcf6ee6)
|
|
|
a9bbe0 |
(cherry picked from commit 87526376857eaceae474c9797e3cee5b50597332)
|
|
|
a9bbe0 |
(cherry picked from commit b4807bbb09d9adf82fe9ae12a3af1c852dc4e32d)
|
|
|
a9bbe0 |
---
|
|
|
a9bbe0 |
grub-core/font/font.c | 2 +-
|
|
|
a9bbe0 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
|
|
|
a9bbe0 |
index cfa4bd5096..30cd1fe07f 100644
|
|
|
a9bbe0 |
--- a/grub-core/font/font.c
|
|
|
a9bbe0 |
+++ b/grub-core/font/font.c
|
|
|
a9bbe0 |
@@ -137,7 +137,7 @@ ascii_glyph_lookup (grub_uint32_t code)
|
|
|
a9bbe0 |
ascii_font_glyph[current]->offset_x = 0;
|
|
|
a9bbe0 |
ascii_font_glyph[current]->offset_y = -2;
|
|
|
a9bbe0 |
ascii_font_glyph[current]->device_width = 8;
|
|
|
a9bbe0 |
- ascii_font_glyph[current]->font = NULL;
|
|
|
a9bbe0 |
+ ascii_font_glyph[current]->font = &null_font;
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
grub_memcpy (ascii_font_glyph[current]->bitmap,
|
|
|
a9bbe0 |
&ascii_bitmaps[current * ASCII_BITMAP_SIZE],
|