From: Takashi Iwai Date: Fri, 27 Jan 2017 11:01:51 +0000 (+0100) Subject: pcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open() X-Git-Tag: v1.1.4~39 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=e1143dd9ba350eb19d13d4e298eeb55179712a1e;p=alsa-lib.git pcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open() slave_map[] in snd_pcm_multi_open() is a fixed size array and obviously we have no overflow check, and eventually the program gets an error when more than 64 channels are used. Although we can modify the code to allocate the array dynamically, it turned out that we can drop the whole slave_map[] thingy in this function when looking at the code closely. In the past, it was used to identify the one-to-many mapping. But the check was dropped, and now it's nothing more than a sanity check. Reported-by: Jörg Müller Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index c4b1fba3..9e4be712 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -1015,7 +1015,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, snd_pcm_multi_t *multi; unsigned int i; snd_pcm_stream_t stream; - char slave_map[64][64] = { { 0 } }; int err; assert(pcmp); @@ -1059,8 +1058,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, bind->slave_channel = schannels[i]; if (sidxs[i] < 0) continue; - assert(!slave_map[sidxs[i]][schannels[i]]); - slave_map[sidxs[i]][schannels[i]] = 1; } multi->channels_count = channels_count;