From: Brian Paul Date: Mon, 10 Oct 2016 21:54:09 +0000 (-0600) Subject: stw/wgl: add null context check in wglBindTexImageARB() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7753f040facc89de4dacc33f9407a4fa334bf58c;p=mesa.git stw/wgl: add null context check in wglBindTexImageARB() To avoid dereferencing a null pointer in case wglMakeCurrent() wasn't called. Found while debugging SWKOTOR game. Reviewed-by: Neha Bhende Reviewed-by: Charmaine Lee --- diff --git a/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c b/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c index 5eeb0df21f1..9d766966771 100644 --- a/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c +++ b/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c @@ -129,6 +129,12 @@ wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer) * we do here. */ + if (!curctx) { + debug_printf("No rendering context in wglBindTexImageARB()\n"); + SetLastError(ERROR_INVALID_OPERATION); + return FALSE; + } + fb = stw_framebuffer_from_HPBUFFERARB(hPbuffer); if (!fb) { debug_printf("Invalid pbuffer handle in wglBindTexImageARB()\n");