From: Daniel Kiper <daniel.kiper@oracle.com>
To: Alec Brown <alec.r.brown@oracle.com>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH] gfxmenu/gui_image.c: Fix double free of bitmap
Date: Thu, 14 Dec 2023 19:25:55 +0100 [thread overview]
Message-ID: <ZXtIs5ru523FIXST@tomti.i.net-space.pl> (raw)
In-Reply-To: <20231213222513.2197285-1-alec.r.brown@oracle.com>
On Wed, Dec 13, 2023 at 10:25:13PM +0000, Alec Brown wrote:
> In grub-core/gfxmenu/gui_image.c, coverity detected a double free in the
> function load_image(). The function checks if self->bitmap and self->raw_bitmap
> aren't NULL and then frees them. In the case self->bitmap and self->raw_bitmap
> are the same, only self->raw_bitmap is freed which would also free the memory
> used by self->bitmap. However, in this case self->bitmap isn't being set to NULL
> which could lead to a double free later in the code. After self->raw_bitmap is
> freed, it gets set to the variable bitmap. If this variable is NULL, the code
> could have a path that would free self->bitmap a second time in the function
> rescale_image().
>
> Fixes: CID 292472
>
> Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
prev parent reply other threads:[~2023-12-14 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 22:25 [PATCH] gfxmenu/gui_image.c: Fix double free of bitmap Alec Brown
2023-12-14 18:25 ` Daniel Kiper [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZXtIs5ru523FIXST@tomti.i.net-space.pl \
--to=daniel.kiper@oracle.com \
--cc=alec.r.brown@oracle.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).