[FFmpeg-cvslog] mov: log and return early on non-positive stsd entry counts

Sean McGovern git at videolan.org
Sat Nov 11 05:29:35 EET 2017


ffmpeg | branch: master | Sean McGovern <gseanmcg at gmail.com> | Fri Jul 28 16:17:33 2017 -0400| [d7bdab1ad78ef582ba8c96dc7b79ec9fdbeeb94f] | committer: Sean McGovern

mov: log and return early on non-positive stsd entry counts

Based on an FFmpeg patch by Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index bf68fbd46a..8ff60222ef 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1875,6 +1875,11 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     avio_rb24(pb); /* flags */
     entries = avio_rb32(pb);
 
+    if (entries <= 0) {
+        av_log(c->fc, AV_LOG_ERROR, "invalid STSD entries %d\n", entries);
+        return AVERROR_INVALIDDATA;
+    }
+
     if (sc->extradata) {
         av_log(c->fc, AV_LOG_ERROR,
                "Duplicate stsd found in this track.\n");



More information about the ffmpeg-cvslog mailing list