From edc9825c040a0055c5b1736ec8dc8f1a4fbd87f8 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 20 Oct 2021 11:17:29 +1100 Subject: [PATCH] [client] egl: check for invalid desktop render dimensions --- client/renderers/EGL/desktop.c | 3 +++ client/renderers/EGL/egl.c | 2 +- client/renderers/EGL/postprocess.c | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index 7d06f63d..26f68db3 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -352,6 +352,9 @@ bool egl_desktopRender(EGL_Desktop * desktop, unsigned int outputWidth, const float scaleX, const float scaleY, enum EGL_DesktopScaleType scaleType, LG_RendererRotate rotate, const struct DamageRects * rects) { + if (outputWidth == 0 && outputHeight == 0) + DEBUG_FATAL("outputWidth || outputHeight == 0"); + enum EGL_TexStatus status; if ((status = egl_textureProcess(desktop->texture)) != EGL_TEX_STATUS_OK) { diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index e95378ba..6d6a9cb1 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -1008,7 +1008,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate, } ++this->overlayHistoryIdx; - if (this->start) + if (this->start && this->destRect.w > 0 && this->destRect.h > 0) { if (egl_desktopRender(this->desktop, this->destRect.w, this->destRect.h, diff --git a/client/renderers/EGL/postprocess.c b/client/renderers/EGL/postprocess.c index 1757bd44..89a6f9a0 100644 --- a/client/renderers/EGL/postprocess.c +++ b/client/renderers/EGL/postprocess.c @@ -133,7 +133,7 @@ static void loadPresetList(struct EGL_PostProcess * this) this->activePreset = -1; return; -fail: +fail: free(this->presetDir); this->presetDir = NULL; if (dir) @@ -585,6 +585,9 @@ bool egl_postProcessRun(EGL_PostProcess * this, EGL_Texture * tex, EGL_DesktopRects * rects, int desktopWidth, int desktopHeight, unsigned int targetX, unsigned int targetY) { + if (targetX == 0 && targetY == 0) + DEBUG_FATAL("targetX || targetY == 0"); + EGL_Filter * lastFilter = NULL; unsigned int sizeX, sizeY;