|
|
a9bbe0 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
a9bbe0 |
From: Zhang Boyang <zhangboyang.id@gmail.com>
|
|
|
a9bbe0 |
Date: Wed, 3 Aug 2022 19:45:33 +0800
|
|
|
a9bbe0 |
Subject: [PATCH] font: Reject glyphs exceeds font->max_glyph_width or
|
|
|
a9bbe0 |
font->max_glyph_height
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
Check glyph's width and height against limits specified in font's
|
|
|
a9bbe0 |
metadata. Reject the glyph (and font) if such limits are exceeded.
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
Signed-off-by: Zhang Boyang <zhangboyang.id@gmail.com>
|
|
|
a9bbe0 |
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
a9bbe0 |
(cherry picked from commit 5760fcfd466cc757540ea0d591bad6a08caeaa16)
|
|
|
a9bbe0 |
(cherry picked from commit 3b410ef4bb95e607cadeba2193fa90ae9bddb98d)
|
|
|
a9bbe0 |
(cherry picked from commit 8ebe587def61af7893ebcae87d45c883f3cfb713)
|
|
|
a9bbe0 |
---
|
|
|
a9bbe0 |
grub-core/font/font.c | 4 +++-
|
|
|
a9bbe0 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
a9bbe0 |
|
|
|
a9bbe0 |
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
|
|
|
a9bbe0 |
index b67507fcc8..8d1a990401 100644
|
|
|
a9bbe0 |
--- a/grub-core/font/font.c
|
|
|
a9bbe0 |
+++ b/grub-core/font/font.c
|
|
|
a9bbe0 |
@@ -760,7 +760,9 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code)
|
|
|
a9bbe0 |
|| read_be_uint16 (font->file, &height) != 0
|
|
|
a9bbe0 |
|| read_be_int16 (font->file, &xoff) != 0
|
|
|
a9bbe0 |
|| read_be_int16 (font->file, &yoff) != 0
|
|
|
a9bbe0 |
- || read_be_int16 (font->file, &dwidth) != 0)
|
|
|
a9bbe0 |
+ || read_be_int16 (font->file, &dwidth) != 0
|
|
|
a9bbe0 |
+ || width > font->max_char_width
|
|
|
a9bbe0 |
+ || height > font->max_char_height)
|
|
|
a9bbe0 |
{
|
|
|
a9bbe0 |
remove_font (font);
|
|
|
a9bbe0 |
return 0;
|