From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [PATCH 1/3] ui/spice-display: Avoid dynamic stack allocation
Date: Fri, 18 Aug 2023 18:13:36 +0200 [thread overview]
Message-ID: <e9f0cf8c-768b-ac0c-a0d2-c176f303ff4d@linaro.org> (raw)
In-Reply-To: <20230818151057.1541189-2-peter.maydell@linaro.org>
On 18/8/23 17:10, Peter Maydell wrote:
> Use an autofree heap allocation instead of a variable-length
> array on the stack in qemu_spice_create_update().
>
> The codebase has very few VLAs, and if we can get rid of them all we
> can make the compiler error on new additions. This is a defensive
> measure against security bugs where an on-stack dynamic allocation
> isn't correctly size-checked (e.g. CVE-2021-3527).
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I was a little unsure about this allocation given that it's
> in the display_refresh callback, but the code already does
> a g_malloc() every time it calls qemu_spice_create_one_update()
> so one more presumably won't hurt.
> ---
> ui/spice-display.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2023-08-18 16:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 15:10 [PATCH 0/3] ui: avoid dynamic stack allocations Peter Maydell
2023-08-18 15:10 ` [PATCH 1/3] ui/spice-display: Avoid dynamic stack allocation Peter Maydell
2023-08-18 16:13 ` Philippe Mathieu-Daudé [this message]
2023-08-18 15:10 ` [PATCH 2/3] ui/vnc-enc-hextile: Use static rather than dynamic length stack array Peter Maydell
2023-08-18 16:16 ` Philippe Mathieu-Daudé
2023-08-21 7:59 ` Marc-André Lureau
2023-08-18 15:10 ` [PATCH 3/3] ui/vnc-enc-tight: Avoid dynamic stack allocation Peter Maydell
2023-08-21 7:26 ` Francisco Iglesias
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=e9f0cf8c-768b-ac0c-a0d2-c176f303ff4d@linaro.org \
--to=philmd@linaro.org \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).