mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	protocol-native: Fail if trying to push unaligned memblock into queue
We will just ignore the memblock if this happens. We already have a check for this in the client library, so this one is just for security reasons. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
		
							parent
							
								
									150ace90f3
								
							
						
					
					
						commit
						22827a5e1e
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -4922,6 +4922,13 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
 | 
				
			||||||
    if (playback_stream_isinstance(stream)) {
 | 
					    if (playback_stream_isinstance(stream)) {
 | 
				
			||||||
        playback_stream *ps = PLAYBACK_STREAM(stream);
 | 
					        playback_stream *ps = PLAYBACK_STREAM(stream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        size_t frame_size = pa_frame_size(&ps->sink_input->sample_spec);
 | 
				
			||||||
 | 
					        if (chunk->index % frame_size != 0 || chunk->length % frame_size != 0) {
 | 
				
			||||||
 | 
					            pa_log_warn("Client sent non-aligned memblock: index %d, length %d, frame size: %d",
 | 
				
			||||||
 | 
					                        (int) chunk->index, (int) chunk->length, (int) frame_size);
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pa_atomic_inc(&ps->seek_or_post_in_queue);
 | 
					        pa_atomic_inc(&ps->seek_or_post_in_queue);
 | 
				
			||||||
        if (chunk->memblock) {
 | 
					        if (chunk->memblock) {
 | 
				
			||||||
            if (seek != PA_SEEK_RELATIVE || offset != 0)
 | 
					            if (seek != PA_SEEK_RELATIVE || offset != 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue