Commit 28d63471 authored by Michael Niedermayer's avatar Michael Niedermayer

avidec: Fix regression with chunks that are larger than the file.

This commit makes the check specific to the case that needs it.

Regression was introduced by
commit 62adc60b
Author: Michael Niedermayer <michaelni@gmx.at>
Date:   Fri Dec 16 06:13:04 2011 +0100

    avidec: Check that the header chunks fit in the available filesize.
    Fixes Ticket771
    Bug found by: Diana Elena Muscalu
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 59e95fa4
......@@ -387,11 +387,6 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
tag = avio_rl32(pb);
size = avio_rl32(pb);
if(size > avi->fsize){
av_log(s, AV_LOG_ERROR, "chunk size is too big during header parsing\n");
goto fail;
}
print_tag("tag", tag, size);
switch(tag) {
......@@ -605,7 +600,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
break;
}
if(size > 10*4 && size<(1<<30)){
if(size > 10*4 && size<(1<<30) && size < avi->fsize){
st->codec->extradata_size= size - 10*4;
st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata) {
......
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