summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2022-10-17 13:52:51 +0200
committerJaroslav Kysela <perex@perex.cz>2022-10-17 13:58:41 +0200
commit9253f08fb784ad6a8b67b63e64732cb2f5694b6a (patch)
tree725bae6553923f4f8e9927dbd86192b76b5f9b5c
parentdac9059524f6fb6eda32565b19ce145df125e17e (diff)
downloadalsa-lib-9253f08fb784ad6a8b67b63e64732cb2f5694b6a.tar.gz
pcm: rate: fix the crash for the partial period copy
The size argument in snd_pcm_rate_commit_area can be smaller than cont in drain. Return the original code. It should not make things worse. Perhaps, we can fill the rest of the period with silence in this case. Fixes: https://github.com/alsa-project/alsa-lib/issues/274 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/pcm/pcm_rate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
index e8815e8b..e5d8eddd 100644
--- a/src/pcm/pcm_rate.c
+++ b/src/pcm/pcm_rate.c
@@ -770,7 +770,7 @@ static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
snd_pcm_uframes_t appl_offset,
- snd_pcm_uframes_t size,
+ snd_pcm_uframes_t size ATTRIBUTE_UNUSED,
snd_pcm_uframes_t slave_size)
{
snd_pcm_uframes_t cont = pcm->buffer_size - appl_offset;
@@ -816,7 +816,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
pcm->format);
snd_pcm_areas_copy(rate->pareas, cont,
areas, 0,
- pcm->channels, size - cont,
+ pcm->channels, pcm->period_size - cont,
pcm->format);
snd_pcm_rate_write_areas1(pcm, rate->pareas, 0, rate->sareas, 0);