]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: fix and optimize snd_pcm_areas_copy function
authorJaroslav Kysela <perex@perex.cz>
Wed, 20 Mar 2013 19:37:50 +0000 (20:37 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 20 Mar 2013 19:43:34 +0000 (20:43 +0100)
commit009193a34575fe439211b9a711e56322afc7460e
treedf86b1772065bc97786359e4eb63d03f86d0d3f4
parent28493d9d693b1387ed38a849b2d256b34baba2b4
pcm: fix and optimize snd_pcm_areas_copy function

The memcpy() function in snd_pcm_area_copy() should not be called
with the overlapped areas. Alex discovered - using own LD_PRELOAD checked
for memcpy() input - that the memcpy() is called with src == dst.

For some special plugin combos (rate+softvol+hw for example), the same
areas with same offsets can be asked to be copied (softvol). The collapse
check uses own areas created on heap, causing dst_area == src_area &&
dst_offset == src_offset check bypassed.

Two fixes are in this patch:

- use assert to check the memcpy() input for future triggers
- bypass the snd_pcm_area_copy() call for collapsed identical areas

Reported-by: Alexander Kruppa <akruppa@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm.c