On 07/09/16 11:35, Diego Biurrun wrote:
> On Wed, Sep 07, 2016 at 12:17:13AM +0200, Luca Barbato wrote:
>> On 06/09/16 18:11, Diego Biurrun wrote:
>>> ptrdiff_t is the correct type for array strides and similar.
>>> --- a/libavcodec/svq3.c
>>> +++ b/libavcodec/svq3.c
>>> @@ -118,8 +118,9 @@ typedef struct SVQ3Context {
>>>      int mb_width, mb_height;
>>> -    int mb_stride, mb_num;
>>> -    int b_stride;
>>> +    ptrdiff_t mb_stride;
>>> +    int mb_num;
>>> +    ptrdiff_t b_stride;
>>>  
>>> @@ -252,7 +253,7 @@ static void svq3_luma_dc_dequant_idct_c(int16_t 
>>> *output, int16_t *input, int qp)
>>> -                            int stride, int qp, int dc)
>>> +                            ptrdiff_t stride, int qp, int dc)
>>>  {
>>>      const int qmul = svq3_dequant_coeff[qp];
>>> @@ -1329,7 +1330,7 @@ static int get_buffer(AVCodecContext *avctx, 
>>> SVQ3Frame *pic)
>>>      const int big_mb_num    = s->mb_stride * (s->mb_height + 1) + 1;
>>>      const int mb_array_size = s->mb_stride * s->mb_height;
>>
>> Those two would need to be changed as well or maybe mb_stride could be
>> kept as integer.
> 
> I disagree. Strides and sizes are not the same thing. Of course it would
> be better to use unsigned or size_t instead of int for sizes.

It practice shouldn't make any difference. IIRC the values for those
fields are constrained to be way smaller than INT_MAX already so the
multiplication won't overflow.

lu
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to