mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	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 <joerg.mueller7744@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									4dfa8f08fb
								
							
						
					
					
						commit
						e1143dd9ba
					
				
					 1 changed files with 0 additions and 3 deletions
				
			
		| 
						 | 
					@ -1015,7 +1015,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
 | 
				
			||||||
	snd_pcm_multi_t *multi;
 | 
						snd_pcm_multi_t *multi;
 | 
				
			||||||
	unsigned int i;
 | 
						unsigned int i;
 | 
				
			||||||
	snd_pcm_stream_t stream;
 | 
						snd_pcm_stream_t stream;
 | 
				
			||||||
	char slave_map[64][64] = { { 0 } };
 | 
					 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(pcmp);
 | 
						assert(pcmp);
 | 
				
			||||||
| 
						 | 
					@ -1059,8 +1058,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
 | 
				
			||||||
		bind->slave_channel = schannels[i];
 | 
							bind->slave_channel = schannels[i];
 | 
				
			||||||
		if (sidxs[i] < 0)
 | 
							if (sidxs[i] < 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		assert(!slave_map[sidxs[i]][schannels[i]]);
 | 
					 | 
				
			||||||
		slave_map[sidxs[i]][schannels[i]] = 1;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	multi->channels_count = channels_count;
 | 
						multi->channels_count = channels_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue