From 4239660e3477fc4db87cd5b56c6d4ee1be17d81a Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Mon, 4 Sep 2017 18:22:49 +0200 Subject: [PATCH] client/X11: Check arguments in xf_Bitmap_SetSurface Arguments of xf_Bitmap_SetSurface are not checked before use currently which may lead to segfaults. It may happen if bitmap is not found in a cache from some reason. Let's check the arguments before use similarly as it is done in client/Windows/wf_graphics.c in order to avoid segfaults. https://github.com/FreeRDP/FreeRDP/issues/4117 --- client/X11/xf_graphics.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index de7e03f23..67c8dec41 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -202,6 +202,10 @@ static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { xfContext* xfc = (xfContext*) context; + + if (!context || (!bitmap && !primary)) + return FALSE; + xf_lock_x11(xfc, FALSE); if (primary)