[FFmpeg-cvslog] avformat/filmstripdec: Fix several integer overflows

Michael Niedermayer git at videolan.org
Mon Oct 27 23:04:33 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct 27 22:56:04 2014 +0100| [9612dcd6b24f21b28940ef95f31335ab436b255d] | committer: Michael Niedermayer

avformat/filmstripdec: Fix several integer overflows

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/filmstripdec.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 155ded2..b76d4b7 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -67,6 +67,12 @@ static int read_header(AVFormatContext *s)
     st->codec->width      = avio_rb16(pb);
     st->codec->height     = avio_rb16(pb);
     film->leading         = avio_rb16(pb);
+
+    if (st->codec->width * 4LL * st->codec->height >= INT_MAX) {
+        av_log(s, AV_LOG_ERROR, "dimensions too large\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     avpriv_set_pts_info(st, 64, 1, avio_rb16(pb));
 
     avio_seek(pb, 0, SEEK_SET);
@@ -82,7 +88,7 @@ static int read_packet(AVFormatContext *s,
 
     if (avio_feof(s->pb))
         return AVERROR(EIO);
-    pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
+    pkt->dts = avio_tell(s->pb) / (st->codec->width * (int64_t)(st->codec->height + film->leading) * 4);
     pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
     avio_skip(s->pb, st->codec->width * (int64_t) film->leading * 4);
     if (pkt->size < 0)



More information about the ffmpeg-cvslog mailing list