[FFmpeg-devel] [PATCH]lavf/mov: Do not blindly allocate stts entries

Carl Eugen Hoyos ceffmpeg at gmail.com
Fri Dec 29 22:25:20 EET 2017


2017-12-29 20:47 GMT+01:00 Derek Buitenhuis <derek.buitenhuis at gmail.com>:
> On 12/29/2017 1:10 AM, Carl Eugen Hoyos wrote:
>> New patch attached, only tested with fate.
>
>> +    if (INT_MAX / sizeof(*sc->stts_data) <= entries)

This is an arbitrary limit...

>>          return AVERROR(ENOMEM);
>
> Should probably be something thing AVERROR(EINVAL), I think.

... and it is therefore - imo - not correct to return EINVAL.

>> +    sc->stts_count = FFMIN(1024 * 1024, entries);

This is not a limit and therefore not an arbitrary limit.

> As stated in the past many times, I am not a fan of hardcoding
> arbitrary max hard limits.

There is no hard limit here (but only above), it just doesn't make much
sense to allocate several G for a file that's just a few bytes long.

Carl Eugen


More information about the ffmpeg-devel mailing list