Merge commit '4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b'

* commit '4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b':
  electronicarts: do not fail on zero-sized chunks

Conflicts:
	libavformat/electronicarts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-08-22 19:01:26 +02:00
commit 350dd85345

View File

@ -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