diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-29 23:22:41 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-03 22:41:40 +0100 |
commit | fa97a8030f6d13aa1aafa583c6e40445c574fb8f (patch) | |
tree | 69cde322e8309bcf79c28fafd2b9ca7c2a261927 | |
parent | 53c430415a65cb4097bdb59b924aaa09bc5e2bb2 (diff) | |
download | ffmpeg-fa97a8030f6d13aa1aafa583c6e40445c574fb8f.tar.gz |
flvdec: Check index for being valid
Fixes seeking in Enigma_Principles_of_Lust.flv
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit df0bff6643cadbd9c07bbe2b0536a7c9d0dfe0c6)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/flvdec.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 0699f544b5..ce6d535753 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -197,7 +197,16 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream } } - if (timeslen == fileposlen && fileposlen && max_pos <= filepositions[0]) { + if (timeslen == fileposlen && fileposlen>1 && max_pos <= filepositions[0]) { + int64_t dts, size0, size1; + avio_seek(ioc, filepositions[1]-4, SEEK_SET); + size0 = avio_rb32(ioc); + avio_r8(ioc); + size1 = avio_rb24(ioc); + dts = avio_rb24(ioc); + dts |= avio_r8(ioc) << 24; + if (size0 > filepositions[1] || FFABS(dts - times[1]*1000)>5000) + goto finish; for(i = 0; i < timeslen; i++) av_add_index_entry(vstream, filepositions[i], times[i]*1000, 0, 0, AVINDEX_KEYFRAME); } else |