ossaudio: prevent SIGSEGV in oss_enable_out
authorVolker Rümelin <vr_qemu@t-online.de>
Thu, 23 Jan 2020 07:49:40 +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 patch reverts a small part of dc88e38fa7 "audio:
unify input and output mixeng buffer management".

To reproduce the problem start qemu with
-audiodev oss,id=audio0,try-mmap=on,out.mixing-engine=off

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

index 576b5b5b20210c3c0bd7eaebabbb815d801f5aa2..39a6fc09e5df45abef3be1568f1678ca71b95afb 100644 (file)
@@ -592,7 +592,7 @@ static void oss_enable_out(HWVoiceOut *hw, bool enable)
             return;
         }
 
-        audio_pcm_info_clear_buf(&hw->info, hw->buf_emul, hw->mix_buf->size);
+        audio_pcm_info_clear_buf(&hw->info, hw->buf_emul, hw->samples);
         trig = PCM_ENABLE_OUTPUT;
         if (ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) {
             oss_logerr(errno,