From 004cf887b70aace0e13db8e38a2c3d4df55852b3 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 12 Apr 2021 11:58:38 +0200 Subject: [PATCH] render/gles2: prevent imported DMA-BUF textures from being mutated The compositor shouldn't write to client buffers if the client attaches a DMA-BUF to a wl_surface, then attaches a shm buffer. Make gles2_texture_write_pixels return an error to prevent this from happening. --- render/gles2/texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render/gles2/texture.c b/render/gles2/texture.c index fe7518d0..d7a052e9 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -53,7 +53,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture, const void *data) { struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture); - if (texture->target != GL_TEXTURE_2D) { + if (texture->target != GL_TEXTURE_2D || texture->image != EGL_NO_IMAGE_KHR) { wlr_log(WLR_ERROR, "Cannot write pixels to immutable texture"); return false; }