]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: Discard last STSC if its empty
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 4 Feb 2020 08:45:35 +0000 (09:45 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 4 Apr 2020 20:09:46 +0000 (22:09 +0200)
Fixes: Ticket8508
libavformat/mov.c

index f01502a5f88433cf6fdf5187e0c33a120e564725..a46787373f56324c0e196c94d0a6a1bfde4ad034 100644 (file)
@@ -2677,6 +2677,10 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             sc->stsc_data[i].id < 1) {
             av_log(c->fc, AV_LOG_WARNING, "STSC entry %d is invalid (first=%d count=%d id=%d)\n", i, sc->stsc_data[i].first, sc->stsc_data[i].count, sc->stsc_data[i].id);
             if (i+1 >= sc->stsc_count) {
+                if (sc->stsc_data[i].count == 0 && i > 0) {
+                    sc->stsc_count --;
+                    continue;
+                }
                 sc->stsc_data[i].first = FFMAX(sc->stsc_data[i].first, first_min);
                 if (i > 0 && sc->stsc_data[i].first <= sc->stsc_data[i-1].first)
                     sc->stsc_data[i].first = FFMIN(sc->stsc_data[i-1].first + 1LL, INT_MAX);