[FFmpeg-devel] [PATCH 2/3] avformat: fix overflows during bit rate calculation

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Wed Dec 14 02:10:57 EET 2016


On 13.12.2016 08:14, Paul B Mahol wrote:
> On 12/13/16, Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> wrote:
>> The bit_rate field has type int64_t since commit
>> 7404f3bdb90e6a5dcb59bc0a091e2c5c038e557d.
>>
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>> ---
>>  libavformat/adxdec.c         | 2 +-
>>  libavformat/aiffdec.c        | 4 ++--
>>  libavformat/apc.c            | 2 +-
>>  libavformat/bfi.c            | 2 +-
>>  libavformat/electronicarts.c | 2 +-
>>  libavformat/iff.c            | 2 +-
>>  libavformat/soxdec.c         | 2 +-
>>  libavformat/voc_packet.c     | 2 +-
>>  libavformat/vqf.c            | 2 +-
>>  libavformat/wsddec.c         | 2 +-
>>  10 files changed, 11 insertions(+), 11 deletions(-)
>>
> 
> probably ok

Pushed.

> Maybe my C sucks, but isn't this already covered when 8LL is used for
> some cases?

No. The multiplications are done from left to right, so unless the 8LL
is part of the first multiplication, that operation is still dealing with
int32_t and can thus overflow.

Best regards,
Andreas



More information about the ffmpeg-devel mailing list