]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
video/readers/png: Refuse to handle multiple image headers
authorDaniel Axtens <dja@axtens.net>
Tue, 6 Jul 2021 04:13:40 +0000 (14:13 +1000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 7 Jun 2022 14:39:32 +0000 (16:39 +0200)
This causes the bitmap to be leaked. Do not permit multiple image headers.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/video/readers/png.c

index d715c4629fea7259e64bfefd24b45946548186a4..35ae553c8e26010db28583c0afeebc0580eb03b0 100644 (file)
@@ -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);