wayland: Seal SHM buffers before access
If wayland client lies about size of given buffer, compositor could touch bad memory and get SIGBUS. Wayland provides simple API to fix it - so fix it! [1] http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-server.h#n416 [2] http://lists.freedesktop.org/archives/wayland-devel/2013-November/012159.html Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> https://bugzilla.gnome.org/show_bug.cgi?id=727893
This commit is contained in:

committed by
Jasper St. Pierre

parent
87eb5f8632
commit
b6d070b06f
@ -317,6 +317,8 @@ meta_cursor_image_load_from_buffer (MetaCursorImage *image,
|
||||
{
|
||||
int rowstride = wl_shm_buffer_get_stride (shm_buffer);
|
||||
|
||||
wl_shm_buffer_begin_access (shm_buffer);
|
||||
|
||||
switch (wl_shm_buffer_get_format (shm_buffer))
|
||||
{
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
@ -344,6 +346,8 @@ meta_cursor_image_load_from_buffer (MetaCursorImage *image,
|
||||
(uint8_t *) wl_shm_buffer_get_data (shm_buffer),
|
||||
width, height, rowstride,
|
||||
gbm_format);
|
||||
|
||||
wl_shm_buffer_end_access (shm_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user