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

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