Commit 350dd853 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '4d6c5152'

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

Conflicts:
	libavformat/electronicarts.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents e356f6c5 4d6c5152
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment