https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3600 https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/920beea3eb55ee7156bd8c00a201bdcafa0df5b0 From 920beea3eb55ee7156bd8c00a201bdcafa0df5b0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 22 Oct 2023 17:26:25 +0200 Subject: [PATCH] alsa: guard agaist NULL areas snd_pcm_ioplug_mmap_areas() can fail and return NULL Fixes #3600 --- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c +++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c @@ -309,21 +309,21 @@ snd_pcm_pipewire_process(snd_pcm_pipewire_t *pw, struct pw_buffer *b, xfer = nframes; if (xfer > 0) { const snd_pcm_channel_area_t *areas = snd_pcm_ioplug_mmap_areas(io); - const snd_pcm_uframes_t offset = hw_ptr % io->buffer_size; - - if (io->stream == SND_PCM_STREAM_PLAYBACK) - snd_pcm_areas_copy_wrap(pwareas, 0, nframes, - areas, offset, - io->buffer_size, - io->channels, xfer, - io->format); - else - snd_pcm_areas_copy_wrap(areas, offset, - io->buffer_size, - pwareas, 0, nframes, - io->channels, xfer, - io->format); - + if (areas != NULL) { + const snd_pcm_uframes_t offset = hw_ptr % io->buffer_size; + if (io->stream == SND_PCM_STREAM_PLAYBACK) + snd_pcm_areas_copy_wrap(pwareas, 0, nframes, + areas, offset, + io->buffer_size, + io->channels, xfer, + io->format); + else + snd_pcm_areas_copy_wrap(areas, offset, + io->buffer_size, + pwareas, 0, nframes, + io->channels, xfer, + io->format); + } hw_ptr += xfer; if (hw_ptr >= pw->boundary) hw_ptr -= pw->boundary; -- GitLab