diff --git a/libavformat/avidec.c b/libavformat/avidec.c index f119a1ab45..db0ed3c890 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -157,7 +157,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ AVIStream *ast; int i; int64_t last_pos= -1; - int64_t filesize= avio_size(s->pb); + int64_t filesize= avi->fsize; av_dlog(s, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n", longs_pre_entry,index_type, entries_in_use, chunk_id, base); @@ -372,7 +372,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(avi, AV_LOG_DEBUG, "use odml:%d\n", avi->use_odml); avi->fsize = avio_size(pb); - if(avi->fsize<=0) + if(avi->fsize<=0 || avi->fsize < avi->riff_end) avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end; /* first list tag */ @@ -398,7 +398,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); - else avi->movi_end = avio_size(pb); + else avi->movi_end = avi->fsize; av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } @@ -731,7 +731,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) "I will ignore it and try to continue anyway.\n"); if (s->error_recognition >= FF_ER_EXPLODE) goto fail; avi->movi_list = avio_tell(pb) - 4; - avi->movi_end = avio_size(pb); + avi->movi_end = avi->fsize; goto end_of_header; } /* skip tag */ diff --git a/tests/ref/fate/aasc b/tests/ref/fate/aasc index 7ec02ba575..07b326983d 100644 --- a/tests/ref/fate/aasc +++ b/tests/ref/fate/aasc @@ -21,3 +21,4 @@ 0, 72000, 168000, 0x646fa087 0, 75600, 168000, 0x404450a2 0, 79200, 168000, 0x5214c456 +0, 82800, 168000, 0xe573025c diff --git a/tests/ref/fate/cvid b/tests/ref/fate/cvid index d7ebe1193d..9a85275c69 100644 --- a/tests/ref/fate/cvid +++ b/tests/ref/fate/cvid @@ -76,3 +76,4 @@ 0, 562500, 112400, 0xe4394f1f 0, 570000, 112400, 0x8ca8649f 0, 577500, 112400, 0x804d44eb +0, 585000, 112400, 0x3864488b diff --git a/tests/ref/fate/fraps-v5 b/tests/ref/fate/fraps-v5 index 3fe1c49329..05fa9da37b 100644 --- a/tests/ref/fate/fraps-v5 +++ b/tests/ref/fate/fraps-v5 @@ -56,3 +56,4 @@ 0, 165000, 145152, 0x80448031 0, 168000, 145152, 0xe3b1fbf7 0, 171000, 145152, 0xa00395a4 +0, 174000, 145152, 0xdf3b4fce diff --git a/tests/ref/fate/truemotion1-24 b/tests/ref/fate/truemotion1-24 index b0b1c4e44e..edca66fe43 100644 --- a/tests/ref/fate/truemotion1-24 +++ b/tests/ref/fate/truemotion1-24 @@ -30,6 +30,7 @@ 1, 82898, 10832, 0x3c746fbe 0, 84000, 69120, 0x5876d758 1, 88424, 10832, 0x05f3b08a +0, 90000, 69120, 0x45e7dd5c 1, 93951, 10832, 0xa6560483 1, 99478, 10832, 0xd98a8e19 1, 105004, 10832, 0xf98a0b2e diff --git a/tests/ref/fate/vp5 b/tests/ref/fate/vp5 index bf67801a47..556d1112d7 100644 --- a/tests/ref/fate/vp5 +++ b/tests/ref/fate/vp5 @@ -244,3 +244,4 @@ 0, 912161, 233472, 0x6f530ac6 0, 915915, 233472, 0x94f7466c 0, 919669, 233472, 0xa8c1d365 +0, 923423, 233472, 0xedcff050 diff --git a/tests/ref/fate/zmbv-8bit b/tests/ref/fate/zmbv-8bit index 258147f914..75a212b3c9 100644 --- a/tests/ref/fate/zmbv-8bit +++ b/tests/ref/fate/zmbv-8bit @@ -273,3 +273,4 @@ 0, 349284, 192000, 0xd08e49d1 0, 350568, 192000, 0xd08e49d1 0, 351852, 192000, 0xd08e49d1 +0, 353136, 192000, 0x1f34135f