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