[PATCH weston] gl-renderer: Fix crash in dmabuf format query for fallback formats

Philipp Kerling pkerling at casix.org
Fri Feb 9 20:59:17 UTC 2018


Since formats is an out parameter, we need to copy to the alloc'ed
memory and not over the pointer address.

Signed-off-by: Philipp Kerling <pkerling at casix.org>
---
 libweston/gl-renderer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index 371e06b3..d091d165 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -2122,7 +2122,7 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc,
 	}
 
 	if (fallback) {
-		memcpy(formats, fallback_formats, num * sizeof(int));
+		memcpy(*formats, fallback_formats, num * sizeof(int));
 		*num_formats = num;
 		return;
 	}
-- 
2.16.1



More information about the wayland-devel mailing list