Merge commit '64f7575fbd64e5b65d5c644347408588c776f1fe'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 19 Dec 2014 11:24:36 +0000 (12:24 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 19 Dec 2014 11:31:52 +0000 (12:31 +0100)
* commit '64f7575fbd64e5b65d5c644347408588c776f1fe':
  mov: avoid a memleak when multiple stss boxes are present

Conflicts:
libavformat/mov.c

See: 5ab882d7283f57560c889919c35f2688253b1d9c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mov.c

@@@ -1966,15 -1815,12 +1966,17 @@@ static int mov_read_stss(MOVContext *c
      if (!entries)
      {
          sc->keyframe_absent = 1;
 +        if (!st->need_parsing && st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
 +            st->need_parsing = AVSTREAM_PARSE_HEADERS;
          return 0;
      }
-     av_free(sc->keyframes);
 +    if (sc->keyframes)
 +        av_log(c->fc, AV_LOG_WARNING, "Duplicated STSS atom\n");
 -    sc->keyframes = av_malloc(entries * sizeof(int));
+     if (entries >= UINT_MAX / sizeof(int))
+         return AVERROR_INVALIDDATA;
+     av_freep(&sc->keyframes);
 +    sc->keyframe_count = 0;
 +    sc->keyframes = av_malloc_array(entries, sizeof(*sc->keyframes));
      if (!sc->keyframes)
          return AVERROR(ENOMEM);