siff: Fix excessive memory allocation.

Bug found by: Oana Stratulat

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-12-18 22:43:19 +01:00
parent af3f2a87da
commit 1c73391d7d
1 changed files with 5 additions and 0 deletions

View File

@ -201,7 +201,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (!c->curstrm){
int64_t fsize= avio_size(s->pb);
size = c->pktsize - c->sndsize;
if(fsize>0)
size= FFMIN(size, fsize - avio_tell(s->pb) + c->gmcsize + 3);
if(size < 2 + c->gmcsize || c->pktsize < c->sndsize)
return AVERROR_INVALIDDATA;
if (av_new_packet(pkt, size) < 0)
return AVERROR(ENOMEM);
AV_WL16(pkt->data, c->flags);