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

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