]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open()
authorTakashi Iwai <tiwai@suse.de>
Fri, 27 Jan 2017 11:01:51 +0000 (12:01 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 27 Jan 2017 11:05:32 +0000 (12:05 +0100)
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 <joerg.mueller7744@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_multi.c

index c4b1fba32cacb95edf3097e9498a8a3ba47d6081..9e4be7122c0fdefbda4b2b910b7898a5e11f35c2 100644 (file)
@@ -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;