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

Jose Fonseca jfonseca at vmware.com
Mon Mar 27 10:37:02 UTC 2017


On 26/03/17 23:29, Miklós Máté wrote:
> 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

This is probably related with the issues that Federico Dossena is 
seeing.  From Feferico's traces it looks like some KOTOR 
wglMake*Current* calls are failing with Mesa, which should probably 
never happen.

Jose



More information about the mesa-dev mailing list