pcm: fix and optimize snd_pcm_areas_copy function
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 <03caf44d70b91bc0d7a479a2256b04d55089c495@gmail.com>
Signed-off-by: Jaroslav Kysela <72edd5e1a572f82f059ccbb83c92b74d6cb051ff@perex.cz>

mikelima/alsa-lib,lgirdwood/alsa-lib,mikelima/alsa-lib,lgirdwood/alsa-lib,alsa-project/alsa-lib,takaswie/alsa-lib,zedongchen/alsa-lib,takaswie/alsa-lib,takaswie/alsa-lib,alsa-project/alsa-lib,takaswie/alsa-lib,takaswie/alsa-lib,zedongchen/alsa-lib,Distrotech/alsa-lib,Distrotech/alsa-lib,zedongchen/alsa-lib,tiwai/alsa-lib,mengdonglin/alsa-lib,tiwai/alsa-lib,lgirdwood/alsa-lib,mengdonglin/alsa-lib,zedongchen/alsa-lib,Distrotech/alsa-lib,zedongchen/alsa-lib,Distrotech/alsa-lib,lgirdwood/alsa-lib,lgirdwood/alsa-lib,mikelima/alsa-lib,alsa-project/alsa-lib,mengdonglin/alsa-lib,mikelima/alsa-lib,mengdonglin/alsa-lib,alsa-project/alsa-lib,Distrotech/alsa-lib,mengdonglin/alsa-lib,tiwai/alsa-lib,tiwai/alsa-lib,mikelima/alsa-lib