Blame SOURCES/0288-gfxmenu-Fix-double-free-in-load_image.patch

9723a8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
c294fc
From: Alexey Makhalov <amakhalov@vmware.com>
c294fc
Date: Wed, 8 Jul 2020 20:41:56 +0000
9723a8
Subject: [PATCH] gfxmenu: Fix double free in load_image()
c294fc
c294fc
self->bitmap should be zeroed after free. Otherwise, there is a chance
c294fc
to double free (USE_AFTER_FREE) it later in rescale_image().
c294fc
c294fc
Fixes: CID 292472
c294fc
c294fc
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
c294fc
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
c294fc
Upstream-commit-id: 5d3e84b15a4
c294fc
---
c294fc
 grub-core/gfxmenu/gui_image.c | 5 ++++-
c294fc
 1 file changed, 4 insertions(+), 1 deletion(-)
c294fc
c294fc
diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c
b71686
index 29784ed2d..6b2e976f1 100644
c294fc
--- a/grub-core/gfxmenu/gui_image.c
c294fc
+++ b/grub-core/gfxmenu/gui_image.c
c294fc
@@ -195,7 +195,10 @@ load_image (grub_gui_image_t self, const char *path)
c294fc
     return grub_errno;
c294fc
 
c294fc
   if (self->bitmap && (self->bitmap != self->raw_bitmap))
c294fc
-    grub_video_bitmap_destroy (self->bitmap);
c294fc
+    {
c294fc
+      grub_video_bitmap_destroy (self->bitmap);
c294fc
+      self->bitmap = 0;
c294fc
+    }
c294fc
   if (self->raw_bitmap)
c294fc
     grub_video_bitmap_destroy (self->raw_bitmap);
c294fc