On 18.12.2015 15:46, Anton Khirnov wrote:
> Quoting Luca Barbato (2015-12-18 15:36:33)
>> On 18/12/15 15:25, Andreas Cadhalpun wrote:
>>> On 18.12.2015 12:00, Luca Barbato wrote:
>>>> b- mark the framerate as invalid
>>>
>>> How does one do that?
>>>
>>>> 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.
>>>
>>> So should a negative framerate simply be set to 0?
>>>
>>
>> I'd just have an explode mode: either error out or otherwise set it to
>> invalid (0 is fine as invalid) and let the user decide what to do.

OK, patch doing that attached.

> To elaborate, check if AV_EF_EXPLODE is set in
> AVFormatContext.error_recognition

And thanks for the reminder.

Best regards,
Andreas

>From 06dbcdf1bdcdf30923109da5195948297a828628 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Wed, 16 Dec 2015 20:52:39 +0100
Subject: [PATCH] nuv: sanitize negative fps rate

Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavformat/nuv.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 2a1b70f..c30da60 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -172,6 +172,15 @@ 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) {
+        if (s->error_recognition & AV_EF_EXPLODE) {
+            av_log(s, AV_LOG_ERROR, "Invalid frame rate %f\n", fps);
+            return AVERROR_INVALIDDATA;
+        } else {
+            av_log(s, AV_LOG_WARNING, "Invalid frame rate %f, setting to 0.\n", fps);
+            fps = 0.0f;
+        }
+    }
 
     // number of packets per stream type, -1 means unknown, e.g. streaming
     v_packs = avio_rl32(pb);
-- 
2.6.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to