All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Boyang <zhangboyang.id@gmail.com>
To: grub-devel@gnu.org
Cc: Zhang Boyang <zhangboyang.id@gmail.com>
Subject: [PATCH 2/5] font: Assign null_font to unknown_glyph
Date: Mon,  5 Dec 2022 19:29:37 +0800	[thread overview]
Message-ID: <20221205112940.246486-3-zhangboyang.id@gmail.com> (raw)
In-Reply-To: <20221205112940.246486-1-zhangboyang.id@gmail.com>

Like glyphs in ascii_font_glyph[], assign null_font to
unknown_glyph->font in order to prevent grub_font_get_*() from
dereferencing NULL pointer.

Signed-off-by: Zhang Boyang <zhangboyang.id@gmail.com>
---
 grub-core/font/font.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/grub-core/font/font.c b/grub-core/font/font.c
index 19a47f873..674043d0d 100644
--- a/grub-core/font/font.c
+++ b/grub-core/font/font.c
@@ -177,6 +177,7 @@ grub_font_loader_init (void)
   unknown_glyph->offset_x = 0;
   unknown_glyph->offset_y = -3;
   unknown_glyph->device_width = 8;
+  unknown_glyph->font = &null_font;
   grub_memcpy (unknown_glyph->bitmap,
 	       unknown_glyph_bitmap, sizeof (unknown_glyph_bitmap));
 
-- 
2.30.2



  parent reply	other threads:[~2022-12-05 11:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 11:29 [PATCH 0/5] Font fixes and preliminary HiDPI support Zhang Boyang
2022-12-05 11:29 ` [PATCH 1/5] font: Check return value of grub_malloc() in ascii_glyph_lookup() Zhang Boyang
2022-12-13 17:16   ` Daniel Kiper
2022-12-05 11:29 ` Zhang Boyang [this message]
2022-12-13 17:17   ` [PATCH 2/5] font: Assign null_font to unknown_glyph Daniel Kiper
2022-12-05 11:29 ` [PATCH 3/5] font: Reject fonts with negative max_char_width or max_char_height Zhang Boyang
2022-12-13 17:17   ` Daniel Kiper
2022-12-05 11:29 ` [PATCH 4/5] font: Add font scaling feature to grub_font_draw_glyph() Zhang Boyang
2022-12-05 11:42   ` Zhang Boyang
2022-12-05 11:29 ` [PATCH 5/5] term/gfxterm: Preliminary HiDPI support Zhang Boyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221205112940.246486-3-zhangboyang.id@gmail.com \
    --to=zhangboyang.id@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.