[FFmpeg-devel] [PATCH] Fix signed integer overflows

James Almer jamrial at gmail.com
Sun Aug 20 18:28:29 EEST 2017


On 8/20/2017 4:10 AM, Vitaly Buka wrote:
> Looks like libavcodec/ has more LL or ll than INT64_C.
> Should I update the patch?

IMO yes. LL is known to work whereas ll might not in some fringe setups
(we have a few of those running FATE).

> 
> On Sat, Aug 19, 2017 at 11:35 PM, Hendrik Leppkes <h.leppkes at gmail.com>
> wrote:
> 
>> On Sun, Aug 20, 2017 at 3:19 AM, Vitaly Buka
>> <vitalybuka-at-google.com at ffmpeg.org> wrote:
>>> Signed integer overflow is undefined behavior.
>>> Detected with clang and -fsanitize=signed-integer-overflow
>>>
>>> Signed-off-by: Vitaly Buka <vitalybuka at google.com>
>>> ---
>>>  libavcodec/utils.c    | 2 +-
>>>  libavformat/aviobuf.c | 2 ++
>>>  libavformat/mov.c     | 2 +-
>>>  3 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>>> index 1336e921c9..024dc1f3e2 100644
>>> --- a/libavcodec/utils.c
>>> +++ b/libavcodec/utils.c
>>> @@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>>          }
>>>
>>>          if (!avctx->rc_initial_buffer_occupancy)
>>> -            avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size
>> * 3 / 4;
>>> +            avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size
>> * 3ll / 4;
>>>
>>>
>>
>> Is "ll" portable? We seem to use the INT64_C macro in other places.
>>
>> - Hendrik
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list