nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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