cache: Check return value from offscreen_cache_get
Currently, SetSurface is called regardless of return value from offscreen_cache_get. It may happen that bitmap is not found in a cache from some reason, which may lead to segfaults. Let's check the returned value before use. https://github.com/FreeRDP/FreeRDP/issues/4117
This commit is contained in:
parent
4239660e34
commit
5d6e2078c7
3
libfreerdp/cache/offscreen.c
vendored
3
libfreerdp/cache/offscreen.c
vendored
@ -101,6 +101,9 @@ static BOOL update_gdi_switch_surface(rdpContext* context,
|
|||||||
{
|
{
|
||||||
rdpBitmap* bmp;
|
rdpBitmap* bmp;
|
||||||
bmp = offscreen_cache_get(cache->offscreen, switchSurface->bitmapId);
|
bmp = offscreen_cache_get(cache->offscreen, switchSurface->bitmapId);
|
||||||
|
if (bmp == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
bitmap->SetSurface(context, bmp, FALSE);
|
bitmap->SetSurface(context, bmp, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user