ffmpeg | branch: master | James Almer <[email protected]> | Thu Sep 28 00:09:20 2017 -0300| [d99c3af7072d0011c4f2cbedb2f624e6b616cfc0] | committer: James Almer
Merge commit 'b446f0e98f85e2e931b476e52b319f1c49244660' * commit 'b446f0e98f85e2e931b476e52b319f1c49244660': mov: Do not try to parse multiple stsd for the same track See 8b43ee4054af799e388d380b379a13a60849c1b5 Merged-by: James Almer <[email protected]> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d99c3af7072d0011c4f2cbedb2f624e6b616cfc0 --- libavformat/mov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 19cda1424d..ede9cda9d3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2371,9 +2371,11 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) } if (sc->extradata) { - av_log(c->fc, AV_LOG_ERROR, "Duplicate STSD\n"); + av_log(c->fc, AV_LOG_ERROR, + "Duplicate stsd found in this track.\n"); return AVERROR_INVALIDDATA; } + /* Prepare space for hosting multiple extradata. */ sc->extradata = av_mallocz_array(entries, sizeof(*sc->extradata)); sc->extradata_size = av_mallocz_array(entries, sizeof(*sc->extradata_size)); ====================================================================== diff --cc libavformat/mov.c index 19cda1424d,5c9f85c738..ede9cda9d3 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@@ -2365,24 -1911,23 +2365,26 @@@ static int mov_read_stsd(MOVContext *c 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\n"); + av_log(c->fc, AV_LOG_ERROR, + "Duplicate stsd found in this track.\n"); return AVERROR_INVALIDDATA; } + /* Prepare space for hosting multiple extradata. */ sc->extradata = av_mallocz_array(entries, sizeof(*sc->extradata)); - if (!sc->extradata) - return AVERROR(ENOMEM); - - sc->stsd_count = entries; - sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata_size)); - if (!sc->extradata_size) - return AVERROR(ENOMEM); + sc->extradata_size = av_mallocz_array(entries, sizeof(*sc->extradata_size)); + if (!sc->extradata_size || !sc->extradata) { + ret = AVERROR(ENOMEM); + goto fail; + } - ret = ff_mov_read_stsd_entries(c, pb, sc->stsd_count); + ret = ff_mov_read_stsd_entries(c, pb, entries); if (ret < 0) return ret; _______________________________________________ ffmpeg-cvslog mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
