[Mesa-dev] [PATCH 1/3] stw/wgl: add null context check in wglBindTexImageARB()

Miklós Máté mtmkls at gmail.com
Sun Mar 26 22:29:00 UTC 2017


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 <bhenden at vmware.com>
> Reviewed-by: Charmaine Lee <charmainel at 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



More information about the mesa-dev mailing list