mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	resample: don't copy too much
When we are in passthrough mode, copy only the min of input and output size or else we might overread/overwrite. See #875
This commit is contained in:
		
							parent
							
								
									c0ab4b1b8d
								
							
						
					
					
						commit
						fc044a37af
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -844,9 +844,10 @@ static int impl_node_process(void *object)
 | 
				
			||||||
		 !SPA_FLAG_IS_SET(this->io_rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE));
 | 
							 !SPA_FLAG_IS_SET(this->io_rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (passthrough) {
 | 
						if (passthrough) {
 | 
				
			||||||
 | 
							uint32_t len = SPA_MIN(in_len, out_len);
 | 
				
			||||||
		for (i = 0; i < sb->n_datas; i++)
 | 
							for (i = 0; i < sb->n_datas; i++)
 | 
				
			||||||
			memcpy(dst_datas[i], src_datas[i], in_len * sizeof(float));
 | 
								memcpy(dst_datas[i], src_datas[i], len * sizeof(float));
 | 
				
			||||||
		out_len = in_len;
 | 
							out_len = in_len = len;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		resample_process(&this->resample, src_datas, &in_len, dst_datas, &out_len);
 | 
							resample_process(&this->resample, src_datas, &in_len, dst_datas, &out_len);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue