From: Daniel Axtens Date: Tue, 6 Jul 2021 04:13:40 +0000 (+1000) Subject: video/readers/png: Refuse to handle multiple image headers X-Git-Tag: grub-2.12-rc1~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=347880a13c239b4c2811c94c9a7cf78b607332e3;p=thirdparty%2Fgrub.git video/readers/png: Refuse to handle multiple image headers This causes the bitmap to be leaked. Do not permit multiple image headers. Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper --- diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c index d715c4629..35ae553c8 100644 --- a/grub-core/video/readers/png.c +++ b/grub-core/video/readers/png.c @@ -258,6 +258,9 @@ grub_png_decode_image_header (struct grub_png_data *data) int color_bits; enum grub_video_blit_format blt; + if (data->image_width || data->image_height) + return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: two image headers found"); + data->image_width = grub_png_get_dword (data); data->image_height = grub_png_get_dword (data);