nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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