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>
Jaroslav Kysela
1 year, 6 months ago
769 | 769 | |
770 | 770 | static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate, |
771 | 771 | snd_pcm_uframes_t appl_offset, |
772 | snd_pcm_uframes_t size, | |
772 | snd_pcm_uframes_t size ATTRIBUTE_UNUSED, | |
773 | 773 | snd_pcm_uframes_t slave_size) |
774 | 774 | { |
775 | 775 | snd_pcm_uframes_t cont = pcm->buffer_size - appl_offset; |
815 | 815 | pcm->format); |
816 | 816 | snd_pcm_areas_copy(rate->pareas, cont, |
817 | 817 | areas, 0, |
818 | pcm->channels, size - cont, | |
818 | pcm->channels, pcm->period_size - cont, | |
819 | 819 | pcm->format); |
820 | 820 | |
821 | 821 | snd_pcm_rate_write_areas1(pcm, rate->pareas, 0, rate->sareas, 0); |