[FFmpeg-devel] [PATCH 1/2] avformat/utils: avoid unsigned integer overflows

Paul B Mahol onemda at gmail.com
Sat Feb 15 21:56:08 EET 2020


On 2/15/20, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
> Marton Balint:
>>
>>
>> On Sat, 15 Feb 2020, Nicolas George wrote:
>>
>>> Marton Balint (12020-02-15):
>>>>> +    if (s->nb_streams)
>>>>>     for (i = s->nb_streams - 1; i >= 0; i--)
>>>> Maybe rewrite the loop instead?
>>>>       for (i = s->nb_streams; i-- > 0;)
>>>
>>> Or
>>>
>>>    for (i = s->nb_streams - 1; i < s->nb_streams; i--)
>>
>> Or simply change the loops to normal ascending order? I don't see why
>> these are descending loops in the first place.
>>
> Yeah. This sound like the best idea. One just has to call
> free_stream() instead of ff_free_stream() for this to work.

But perhaps there is some reason for current order?

> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list