summaryrefslogtreecommitdiffstats
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-01-27 18:32:28 +0000
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-01-27 18:32:28 +0000
commite5b5676c008552e7602789cc80c99887d2b33504 (patch)
tree0231d6912fcc7de0879b4725ebe5f5bbe3a9caf6 /libavformat/flvdec.c
parent949d6dd51ce17c6ad62d257022ad9a75bc4cba73 (diff)
parente4eb13ca77624401ea7cef1ed6ad8e2d13fd2063 (diff)
downloadffmpeg-streaming-e5b5676c008552e7602789cc80c99887d2b33504.zip
ffmpeg-streaming-e5b5676c008552e7602789cc80c99887d2b33504.tar.gz
Merge commit 'e4eb13ca77624401ea7cef1ed6ad8e2d13fd2063'
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8ca779d..e72bc81 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -989,17 +989,19 @@ skip:
retry_duration:
avio_seek(s->pb, fsize - 4, SEEK_SET);
size = avio_rb32(s->pb);
- // Seek to the start of the last FLV tag at position (fsize - 4 - size)
- // but skip the byte indicating the type.
- avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
- if (size == avio_rb24(s->pb) + 11) {
- uint32_t ts = avio_rb24(s->pb);
- ts |= avio_r8(s->pb) << 24;
- if (ts)
- s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
- else if (fsize >= 8 && fsize - 8 >= size) {
- fsize -= size+4;
- goto retry_duration;
+ if (size > 0 && size < fsize) {
+ // Seek to the start of the last FLV tag at position (fsize - 4 - size)
+ // but skip the byte indicating the type.
+ avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
+ if (size == avio_rb24(s->pb) + 11) {
+ uint32_t ts = avio_rb24(s->pb);
+ ts |= avio_r8(s->pb) << 24;
+ if (ts)
+ s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
+ else if (fsize >= 8 && fsize - 8 >= size) {
+ fsize -= size+4;
+ goto retry_duration;
+ }
}
}
OpenPOWER on IntegriCloud