mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	shm: Log a warning if a shm buffer address is requested when it may be invalid
If wl_shm_buffer_get_data() is called on a shm pool that has an external reference and a pending resize, then the buffer may be outside the pool's current mapping. Log a warning if this happens. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
		
							parent
							
								
									ed5f5030ca
								
							
						
					
					
						commit
						1d6e885b1d
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -387,6 +387,11 @@ wl_shm_buffer_get_data(struct wl_shm_buffer *buffer)
 | 
				
			||||||
	if (!buffer->pool)
 | 
						if (!buffer->pool)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (buffer->pool->external_refcount &&
 | 
				
			||||||
 | 
						    (buffer->pool->size != buffer->pool->new_size))
 | 
				
			||||||
 | 
							wl_log("Buffer address requested when its parent pool "
 | 
				
			||||||
 | 
							       "has an external reference and a deferred resize "
 | 
				
			||||||
 | 
							       "pending.\n");
 | 
				
			||||||
	return buffer->pool->data + buffer->offset;
 | 
						return buffer->pool->data + buffer->offset;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue