[FFmpeg-devel] [PATCH] avcodec/yuv4enc: do not read past end of input in case of odd height

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Sep 6 14:33:50 EEST 2023


Anton Khirnov:
> Quoting Tomas Härdin (2023-09-06 08:16:12)
>> ons 2023-09-06 klockan 02:35 +0200 skrev Paul B Mahol:
>>> +    if (avctx->height & 1) {
>>> +        for (j = 0; j < avctx->width + 1 >> 1; j++) {
>>
>> Don't we usually wrap shifted expressions in parentheses? I know >> is
>> lower presedence than + (a wtf in itself tbh) but I seem to recall
>> parens being the norm in much of the codebase.
> 
> Using ">> 1" to mean "/ 2" is a relic from the days of non-optimizing
> compilers anyway.
> 

Incorrect for signed expressions (right shift rounds to -inf, division
to zero).

- Andreas



More information about the ffmpeg-devel mailing list