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

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