[FFmpeg-cvslog] avformat/swfenc: Check frama rate before writing it

Michael Niedermayer git at videolan.org
Thu Dec 17 02:38:22 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Dec 17 01:23:43 2015 +0100| [6ea7dd25c773145b50eed55c2059647bb086aaca] | committer: Michael Niedermayer

avformat/swfenc: Check frama rate before writing it

Fixes assertion failure with ffserver

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/swfenc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 56d9879..8d5933e 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -256,6 +256,10 @@ static int swf_write_header(AVFormatContext *s)
                                       (will be patched if not streamed) */
 
     put_swf_rect(pb, 0, width * 20, 0, height * 20);
+    if ((rate * 256LL) / rate_base >= (1<<16)) {
+        av_log(s, AV_LOG_ERROR, "Invalid (too large) frame rate %d/%d\n", rate, rate_base);
+        return AVERROR(EINVAL);
+    }
     avio_wl16(pb, (rate * 256) / rate_base); /* frame rate */
     swf->duration_pos = avio_tell(pb);
     avio_wl16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */



More information about the ffmpeg-cvslog mailing list