mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sample-util: Remove redundant check from pa_volume_memchunk.
Add also an assertion for the sample spec validity. The existing code already does crash in case of an invalid sample spec, but the error would not be as obvious: the crash would happen due to a divide-by-zero operation in pa_frame_aligned().
This commit is contained in:
		
							parent
							
								
									c2c5e044cc
								
							
						
					
					
						commit
						2f7a586a23
					
				
					 1 changed files with 1 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -721,6 +721,7 @@ void pa_volume_memchunk(
 | 
			
		|||
 | 
			
		||||
    pa_assert(c);
 | 
			
		||||
    pa_assert(spec);
 | 
			
		||||
    pa_assert(pa_sample_spec_valid(spec));
 | 
			
		||||
    pa_assert(pa_frame_aligned(c->length, spec));
 | 
			
		||||
    pa_assert(volume);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -735,11 +736,6 @@ void pa_volume_memchunk(
 | 
			
		|||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (spec->format < 0 || spec->format >= PA_SAMPLE_MAX) {
 | 
			
		||||
      pa_log_warn("Unable to change volume of format");
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    do_volume = pa_get_volume_func(spec->format);
 | 
			
		||||
    pa_assert(do_volume);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue