qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Volker Rümelin" <vr_qemu@t-online.de>
To: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org,
	Richard Henderson <richard.henderson@linaro.org>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Thomas Huth <thuth@redhat.com>
Subject: [PATCH v2 2/7] audio: fix SIGSEGV in AUD_get_buffer_size_out()
Date: Thu, 15 May 2025 07:44:24 +0200	[thread overview]
Message-ID: <20250515054429.7385-2-vr_qemu@t-online.de> (raw)
In-Reply-To: <0bb1a55e-70f1-410b-8b59-78eed7f4c8f7@t-online.de>

As far as the emulated audio devices are concerned the pointer
returned by AUD_open_out() is an opaque handle. This includes
the NULL pointer. In this case, AUD_get_buffer_size_out() should
return a sensible buffer size instead of triggering a segmentation
fault. All other public AUD_*_out() and audio_*_out() functions
handle this case.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 audio/audio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/audio/audio.c b/audio/audio.c
index 41ee11aaad..70ef22b1a4 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -905,6 +905,10 @@ size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size)
 
 int AUD_get_buffer_size_out(SWVoiceOut *sw)
 {
+    if (!sw) {
+        return 0;
+    }
+
     return sw->hw->samples * sw->hw->info.bytes_per_frame;
 }
 
-- 
2.43.0



  parent reply	other threads:[~2025-05-15  5:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-15  5:42 [PATCH v2 0/7] audio related fixes for 10.1 Volker Rümelin
2025-05-15  5:44 ` [PATCH v2 1/7] tests/functional: use 'none' audio driver for q800 tests Volker Rümelin
2025-05-15  5:44 ` Volker Rümelin [this message]
2025-05-15  5:44 ` [PATCH v2 3/7] audio: fix size calculation in AUD_get_buffer_size_out() Volker Rümelin
2025-05-15  5:44 ` [PATCH v2 4/7] hw/audio/asc: fix SIGSEGV in asc_realize() Volker Rümelin
2025-05-15 20:57   ` Mark Cave-Ayland
2025-05-15  5:44 ` [PATCH v2 5/7] hw/audio/asc: replace g_malloc0() with g_malloc() Volker Rümelin
2025-05-15  5:44 ` [PATCH v2 6/7] audio/mixeng: remove unnecessary pointer type casts Volker Rümelin
2025-05-15  5:44 ` [PATCH v2 7/7] audio: add float sample endianness converters Volker Rümelin
2025-05-29  7:26 ` [PATCH v2 0/7] audio related fixes for 10.1 Michael Tokarev
2025-06-05 12:13   ` Michael Tokarev

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=20250515054429.7385-2-vr_qemu@t-online.de \
    --to=vr_qemu@t-online.de \
    --cc=alex.bennee@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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).