summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorSean McGovern <gseanmcg@gmail.com>2017-07-28 16:17:33 -0400
committerSean McGovern <gseanmcg@gmail.com>2017-07-30 10:51:12 -0400
commitd7bdab1ad78ef582ba8c96dc7b79ec9fdbeeb94f (patch)
treee14e38afa864d2c9a13a3d3a1f5762e2e14ec334 /libavformat
parentb90fdb2c7199cc8b0e8d994fafba1fb4dc181d88 (diff)
mov: log and return early on non-positive stsd entry counts
Based on an FFmpeg patch by Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c5
1 files changed, 5 insertions, 0 deletions
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");