aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-04 09:45:35 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-04-04 22:09:46 +0200
commit550fa277ef976d386b7b17841cb2dd8d1e5db168 (patch)
treeedac6274e2960353248a3a6357d1e2077bde5bbc
parente057e83a4ff4c0eeeb78dffe58e21af951c056b6 (diff)
downloadffmpeg-550fa277ef976d386b7b17841cb2dd8d1e5db168.tar.gz
avformat/mov: Discard last STSC if its empty
Fixes: Ticket8508
-rw-r--r--libavformat/mov.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f01502a5f8..a46787373f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -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);