]> git.proxmox.com Git - mirror_qemu.git/commitdiff
audio: prevent SIGSEGV in AUD_get_buffer_size_out
authorVolker Rümelin <vr_qemu@t-online.de>
Thu, 23 Jan 2020 07:49:38 +0000 (08:49 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 31 Jan 2020 07:48:03 +0000 (08:48 +0100)
With audiodev parameter out.mixing-engine=off hw->mix_buf is
NULL. This leads to a segmentation fault in
AUD_get_buffer_size_out. This patch reverts a small part of
dc88e38fa7 "audio: unify input and output mixeng buffer
management".

To reproduce the problem start qemu with
-soundhw adlib -audiodev pa,id=audio0,out.mixing-engine=off

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20200123074943.6699-4-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
audio/audio.c

index 9cd76a331d7a49316dec2f4d9eb35227d251ab8d..12ed318813f4c6ffd4447f571b04cf0b6b84f82d 100644 (file)
@@ -879,9 +879,9 @@ size_t AUD_read(SWVoiceIn *sw, void *buf, size_t size)
     }
 }
 
-int AUD_get_buffer_size_out (SWVoiceOut *sw)
+int AUD_get_buffer_size_out(SWVoiceOut *sw)
 {
-    return sw->hw->mix_buf->size * sw->hw->info.bytes_per_frame;
+    return sw->hw->samples * sw->hw->info.bytes_per_frame;
 }
 
 void AUD_set_active_out (SWVoiceOut *sw, int on)