[Mesa-dev] [PATCH] mesa: fix type comparison error in sub-texture error checking code

Tapani Pälli tapani.palli at intel.com
Wed Apr 17 22:51:22 PDT 2013


On 04/17/2013 05:12 PM, Brian Paul wrote:
> On 04/17/2013 12:07 AM, Tapani Pälli wrote:
>> patch fixes a crash that happens if glTexSubImage2D is called with a
>> negative xoffset.
>>
>> Signed-off-by: Tapani Pälli<tapani.palli at intel.com>
>> ---
>>   src/mesa/main/teximage.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index 784b389..ae053e8 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -1536,7 +1536,7 @@ error_check_subtexture_dimensions(struct 
>> gl_context *ctx,
>>      }
>>
>>      /* check xoffset and width */
>> -   if (xoffset<  -destImage->Border) {
>> +   if (xoffset<  (GLint) -destImage->Border) {
>>         _mesa_error(ctx, GL_INVALID_VALUE, "%s%dD(xoffset)",
>>                     function, dims);
>>         return GL_TRUE;
>
> How about "- (GLint) destImage->Border"?  Since Border is uint, I 
> think it's better to cast it to int before negating it.
>
> And there's similar comparisions for yoffset and zoffset below.
>

Thanks, I'll correct the check and see which additional checks require 
typecast, some checks have it already in place.

> -Brian
>


// Tapani



More information about the mesa-dev mailing list