On 24/03/17 22:42, Brian Paul wrote:
To avoid dereferencing a null pointer in case wglMakeCurrent() wasn't
called.  Found while debugging SWKOTOR game.

Reviewed-by: Neha Bhende <bhen...@vmware.com>
Reviewed-by: Charmaine Lee <charmai...@vmware.com>
---
  src/gallium/state_trackers/wgl/stw_ext_rendertexture.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c 
b/src/gallium/state_trackers/wgl/stw_ext_rendertexture.c
index 5eeb0df..9d76696 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");

Hi,

I tested KOTOR with Wine, and AFAICT the context is always valid when wglBindTexImageARB is called.

MM

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to