File 0021-alsa-protect-against-SIGPFE.patch of Package pipewire.16602

From b6e84ded756dd2d777b729d11a7bacb1d1abd1bf Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Mon, 7 Sep 2020 14:57:47 +0200
Subject: [PATCH] alsa: protect against SIGPFE

Make sure we don't try to divide by 0 when the app calls the status
before we are PREPARED.

Fixes #283
---
 pipewire-alsa/alsa-plugins/pcm_pipewire.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pipewire-alsa/alsa-plugins/pcm_pipewire.c b/pipewire-alsa/alsa-plugins/pcm_pipewire.c
index 8520274f..f2db3af5 100644
--- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c
+++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c
@@ -168,6 +168,8 @@ static snd_pcm_sframes_t snd_pcm_pipewire_pointer(snd_pcm_ioplug_t *io)
 		return -EPIPE;
 	if (pw->error < 0)
 		return pw->error;
+	if (io->buffer_size == 0)
+		return 0;
 #ifdef SND_PCM_IOPLUG_FLAG_BOUNDARY_WA
 	return pw->hw_ptr;
 #else
-- 
GitLab

openSUSE Build Service is sponsored by