Blame SOURCES/0222-video-readers-png-Refuse-to-handle-multiple-image-he.patch

e28c09
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e28c09
From: Daniel Axtens <dja@axtens.net>
e28c09
Date: Tue, 6 Jul 2021 14:13:40 +1000
e28c09
Subject: [PATCH] video/readers/png: Refuse to handle multiple image headers
e28c09
e28c09
This causes the bitmap to be leaked. Do not permit multiple image headers.
e28c09
e28c09
Signed-off-by: Daniel Axtens <dja@axtens.net>
e28c09
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
e28c09
(cherry picked from commit 8ce433557adeadbc46429aabb9f850b02ad2bdfb)
e28c09
---
e28c09
 grub-core/video/readers/png.c | 3 +++
e28c09
 1 file changed, 3 insertions(+)
e28c09
e28c09
diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c
e28c09
index e2a6b1cf3c..8955b8ecfd 100644
e28c09
--- a/grub-core/video/readers/png.c
e28c09
+++ b/grub-core/video/readers/png.c
e28c09
@@ -258,6 +258,9 @@ grub_png_decode_image_header (struct grub_png_data *data)
e28c09
   int color_bits;
e28c09
   enum grub_video_blit_format blt;
e28c09
 
e28c09
+  if (data->image_width || data->image_height)
e28c09
+    return grub_error (GRUB_ERR_BAD_FILE_TYPE, "png: two image headers found");
e28c09
+
e28c09
   data->image_width = grub_png_get_dword (data);
e28c09
   data->image_height = grub_png_get_dword (data);
e28c09