movdec: Check count of stts/ctts elements instead of just the pointer.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 29 May 2012 17:28:09 +0000 (19:28 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 29 May 2012 17:56:07 +0000 (19:56 +0200)
Fixes overreading the array

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index 222166e..a7bb076 100644 (file)
@@ -1874,7 +1874,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
             sc->empty_duration = av_rescale(sc->empty_duration, sc->time_scale, mov->time_scale);
         sc->time_offset = sc->start_time - sc->empty_duration;
         current_dts = -sc->time_offset;
-        if (sc->ctts_data && sc->stts_data &&
+        if (sc->ctts_count>0 && sc->stts_count>0 &&
             sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) {
             /* more than 16 frames delay, dts are likely wrong
                this happens with files created by iMovie */