From: Zhang Boyang Date: Wed, 3 Aug 2022 11:45:33 +0000 (+0800) Subject: font: Reject glyphs exceeds font->max_glyph_width or font->max_glyph_height X-Git-Tag: grub-2.12-rc1~224 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6b6236077f059e64ee315f2d7acb8fa4eda87c5;p=thirdparty%2Fgrub.git font: Reject glyphs exceeds font->max_glyph_width or font->max_glyph_height Check glyph's width and height against limits specified in font's metadata. Reject the glyph (and font) if such limits are exceeded. Signed-off-by: Zhang Boyang Reviewed-by: Daniel Kiper --- diff --git a/grub-core/font/font.c b/grub-core/font/font.c index 42189c325..756ca0abf 100644 --- a/grub-core/font/font.c +++ b/grub-core/font/font.c @@ -760,7 +760,9 @@ grub_font_get_glyph_internal (grub_font_t font, grub_uint32_t code) || read_be_uint16 (font->file, &height) != 0 || read_be_int16 (font->file, &xoff) != 0 || read_be_int16 (font->file, &yoff) != 0 - || read_be_int16 (font->file, &dwidth) != 0) + || read_be_int16 (font->file, &dwidth) != 0 + || width > font->max_char_width + || height > font->max_char_height) { remove_font (font); return 0;