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

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