]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f'
authorHendrik Leppkes <h.leppkes@gmail.com>
Mon, 14 Nov 2016 11:41:32 +0000 (12:41 +0100)
committerHendrik Leppkes <h.leppkes@gmail.com>
Mon, 14 Nov 2016 11:41:32 +0000 (12:41 +0100)
* commit '029cf99c5166b36f33381cd8ebfa5f1f1f463d1f':
  mov: Save number of stsd elements after stream extradata allocation

Mostly noop, see 8b43ee4054af799e388d380b379a13a60849c1b5

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
libavformat/mov.c

index 17d63d66d049b02efd608e2fa12d03db0e917f2a,0cb3271d442d72ed88c3aa49b34c362274b1b270..8d6cc12baca02c6aa4302cdf5f578030431ce963
@@@ -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;