From: Zhang Boyang <zhangboyang.id@gmail.com>
To: grub-devel@gnu.org
Cc: Zhang Boyang <zhangboyang.id@gmail.com>
Subject: [PATCH 3/5] font: Reject fonts with negative max_char_width or max_char_height
Date: Mon, 5 Dec 2022 19:29:38 +0800 [thread overview]
Message-ID: <20221205112940.246486-4-zhangboyang.id@gmail.com> (raw)
In-Reply-To: <20221205112940.246486-1-zhangboyang.id@gmail.com>
If max_char_width or max_char_height is negative, bad values might be
propagated by grub_font_get_max_char_width() or
grub_font_get_max_char_height(). Prevent this from happening.
Signed-off-by: Zhang Boyang <zhangboyang.id@gmail.com>
---
grub-core/font/font.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
index 674043d0d..24adcb35a 100644
--- a/grub-core/font/font.c
+++ b/grub-core/font/font.c
@@ -644,8 +644,8 @@ grub_font_load (const char *filename)
font->max_char_width, font->max_char_height, font->num_chars);
#endif
- if (font->max_char_width == 0
- || font->max_char_height == 0
+ if (font->max_char_width <= 0
+ || font->max_char_height <= 0
|| font->num_chars == 0
|| font->char_index == 0 || font->ascent == 0 || font->descent == 0)
{
--
2.30.2
next prev 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 ` [PATCH 2/5] font: Assign null_font to unknown_glyph Zhang Boyang
2022-12-13 17:17 ` Daniel Kiper
2022-12-05 11:29 ` Zhang Boyang [this message]
2022-12-13 17:17 ` [PATCH 3/5] font: Reject fonts with negative max_char_width or max_char_height 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-4-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.