[FFmpeg-cvslog] rmdec: Validate the fps value

Martin Storsjö git at videolan.org
Tue Oct 8 02:07:43 CEST 2013


ffmpeg | branch: release/1.1 | Martin Storsjö <martin at martin.st> | Mon Sep 16 20:58:38 2013 +0300| [99f953b3fe4bc43783208186a64fc38ca71ca2ea] | committer: Luca Barbato

rmdec: Validate the fps value

Abort if it is invalid if strict error checking has been requested.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 0f310a6f333b016d336674d086045e8473fdf918)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

Conflicts:
	libavformat/rmdec.c

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99f953b3fe4bc43783208186a64fc38ca71ca2ea
---

 libavformat/rmdec.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 6495bdf..f8362c0 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -331,8 +331,13 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
         if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
             return ret;
 
-        av_reduce(&st->avg_frame_rate.den, &st->avg_frame_rate.num,
-                  0x10000, fps, (1 << 30) - 1);
+        if (fps > 0) {
+            av_reduce(&st->avg_frame_rate.den, &st->avg_frame_rate.num,
+                      0x10000, fps, (1 << 30) - 1);
+        } else if (s->error_recognition & AV_EF_EXPLODE) {
+            av_log(s, AV_LOG_ERROR, "Invalid framerate\n");
+            return AVERROR_INVALIDDATA;
+        }
 #if FF_API_R_FRAME_RATE
         st->r_frame_rate = st->avg_frame_rate;
 #endif



More information about the ffmpeg-cvslog mailing list