diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-22 19:01:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-22 19:01:26 +0200 |
commit | 350dd8534575e89a8ed5f2bdafc24651a82338e5 (patch) | |
tree | 5c7b5cb2cb9731692dfc64552fe0ec109aa5623e /libavformat | |
parent | e356f6c55d46bf3e58005c4e55b2226834a2c22a (diff) | |
parent | 4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b (diff) | |
download | ffmpeg-350dd8534575e89a8ed5f2bdafc24651a82338e5.tar.gz |
Merge commit '4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b'
* commit '4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b':
electronicarts: do not fail on zero-sized chunks
Conflicts:
libavformat/electronicarts.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/electronicarts.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 515b70fecb..1314f6a144 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -552,7 +552,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) while (!packet_read || partial_packet) { chunk_type = avio_rl32(pb); chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); - if (chunk_size <= 8) + if (chunk_size < 8) return AVERROR_INVALIDDATA; chunk_size -= 8; @@ -577,11 +577,16 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) avio_skip(pb, 8); chunk_size -= 12; } + if (partial_packet) { avpriv_request_sample(s, "video header followed by audio packet"); av_free_packet(pkt); partial_packet = 0; } + + if (!chunk_size) + continue; + ret = av_get_packet(pb, pkt, chunk_size); if (ret < 0) return ret; @@ -642,6 +647,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) goto get_video_packet; case mTCD_TAG: + if (chunk_size < 8) + return AVERROR_INVALIDDATA; + avio_skip(pb, 8); // skip ea DCT header chunk_size -= 8; goto get_video_packet; @@ -652,6 +660,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) key = AV_PKT_FLAG_KEY; case MV0F_TAG: get_video_packet: + if (!chunk_size) + continue; + if (partial_packet) { ret = av_append_packet(pb, pkt, chunk_size); } else |