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