[libav-devel] [PATCH] nuv: reject negative fps rate

Luca Barbato lu_zero at gentoo.org
Fri Dec 18 12:00:02 CET 2015


On 17/12/15 23:01, Andreas Cadhalpun wrote:
> On 16.12.2015 22:18, Luca Barbato wrote:
>> On 16/12/15 20:56, Andreas Cadhalpun wrote:
>>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>>> ---
>>>  libavformat/nuv.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/libavformat/nuv.c b/libavformat/nuv.c
>>> index 2a1b70f..4cb28d5 100644
>>> --- a/libavformat/nuv.c
>>> +++ b/libavformat/nuv.c
>>> @@ -172,6 +172,10 @@ static int nuv_header(AVFormatContext *s)
>>>      if (aspect > 0.9999 && aspect < 1.0001)
>>>          aspect = 4.0 / 3.0;
>>>      fps = av_int2double(avio_rl64(pb));
>>> +    if (fps <= 0.0f) {
>>> +        av_log(s, AV_LOG_ERROR, "Invalid frame rate %f\n", fps);
>>> +        return AVERROR_INVALIDDATA;
>>> +    }
>>>  
>>>      // number of packets per stream type, -1 means unknown, e.g. streaming
>>>      v_packs = avio_rl32(pb);
>>>
>>
>> What happens if a negative fps is used?
> 
> It doesn't make sense. Or what is a negative frame rate supposed to mean?

So the options are:

a- not demux at all
b- mark the framerate as invalid and let the user decide what to do,
e.g. override it with a value that works for them.
c- a or b depending on explode.

A framerate of 0 is the same as a negative framerate for all the
intended purposes.

lu



More information about the libav-devel mailing list