diff options
author | Steven Liu <lq@chinaffmpeg.org> | 2017-03-28 16:51:28 +0800 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2017-03-28 16:51:28 +0800 |
commit | c0628919b8c5761d64b1169e8de7584544d15ebf (patch) | |
tree | d956a32a4de9ca78501ac73b4a1267635237be76 /libavformat/flvdec.c | |
parent | 3fe7bb2bcf1963c3a7bc0f955ffb77cc3184d8f6 (diff) |
avformat/flvdec: check FLVHeader PreviousTagSize0
refer to SPEC:
Annex E. The FLV File Format said:
E.3 TheFLVFileBody have a table:
Field Type Comment
PreviousTagSize0 UI32 Always 0
Reviewed-by: Bela Bodecs <bodecsb@vivanet.hu>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r-- | libavformat/flvdec.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index cdcfb9c5a0..94c9e28334 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -709,6 +709,7 @@ static int flv_read_header(AVFormatContext *s) int flags; FLVContext *flv = s->priv_data; int offset; + int pre_tag_size = 0; avio_skip(s->pb, 4); flags = avio_r8(s->pb); @@ -719,7 +720,16 @@ static int flv_read_header(AVFormatContext *s) offset = avio_rb32(s->pb); avio_seek(s->pb, offset, SEEK_SET); - avio_skip(s->pb, 4); + + /* Annex E. The FLV File Format + * E.3 TheFLVFileBody + * Field Type Comment + * PreviousTagSize0 UI32 Always 0 + * */ + pre_tag_size = avio_rb32(s->pb); + if (pre_tag_size) { + av_log(s, AV_LOG_WARNING, "Read FLV header error, input file is not a standard flv format, first PreviousTagSize0 always is 0\n"); + } s->start_time = 0; flv->sum_flv_tag_size = 0; |