ffmpeg | branch: master | Hendrik Leppkes <h.lepp...@gmail.com> | Mon Nov 14 12:41:32 2016 +0100| [d8ffdefbdce16948c9b3c84df62171a7d58c8253] | committer: Hendrik Leppkes
Merge commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f' * commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f': mov: Save number of stsd elements after stream extradata allocation Mostly noop, see 8b43ee4054af799e388d380b379a13a60849c1b5 Merged-by: Hendrik Leppkes <h.lepp...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8ffdefbdce16948c9b3c84df62171a7d58c8253 --- libavformat/mov.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 17d63d6..8d6cc12 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2332,8 +2332,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; - int ret; - int entries; + int ret, entries; if (c->fc->nb_streams < 1) return 0; @@ -2342,7 +2341,7 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ - entries = avio_rb32(pb); /* entries */ + entries = avio_rb32(pb); if (entries <= 0) { av_log(c->fc, AV_LOG_ERROR, "invalid STSD entries %d\n", entries); ====================================================================== diff --cc libavformat/mov.c index 17d63d6,0cb3271..8d6cc12 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@@ -2342,26 -1892,19 +2341,26 @@@ static int mov_read_stsd(MOVContext *c avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ - entries = avio_rb32(pb); /* entries */ + 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"); + 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 ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog