From 3eb882dd53d6a89da207b7be8063e5b581fd9cbf Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 11 May 2017 13:34:37 +0200 Subject: [PATCH] Check arguments for Bitmap_SetSurface The function may be called during connection phase where there is no valid GDI available. --- libfreerdp/gdi/graphics.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index b1c1b1b47..0424a8ae3 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -183,7 +183,14 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { - rdpGdi* gdi = context->gdi; + rdpGdi* gdi; + + if (!context) + return FALSE; + + gdi = context->gdi; + if (!gdi) + return FALSE; if (primary) gdi->drawing = gdi->primary;