Blame SOURCES/0305-font-Assign-null_font-to-glyphs-in-ascii_font_glyph.patch

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