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

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