summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-10-10 15:54:09 -0600
committerBrian Paul <[email protected]>2017-03-31 13:30:53 -0600
commit7753f040facc89de4dacc33f9407a4fa334bf58c (patch)
treed38c44157279ef0d862c377615e4cc9d898dc701
parent7d2fa8dc105158e7d2d28763cb9ed020ae64b67f (diff)
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 <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_rendertexture.c6
1 files changed, 6 insertions, 0 deletions
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");