Mercurial > libavformat.hg
comparison mov.c @ 4116:f693bc71dc1e libavformat
check that nb_streams is valid before setting stream, fix crash with jp2 which do not use same structure
author | bcoudurier |
---|---|
date | Tue, 16 Dec 2008 08:47:28 +0000 |
parents | 8ddf05b864a4 |
children | 30262468fff4 |
comparison
equal
deleted
inserted
replaced
4115:05d41346b964 | 4116:f693bc71dc1e |
---|---|
597 } | 597 } |
598 | 598 |
599 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ | 599 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ |
600 static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) | 600 static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) |
601 { | 601 { |
602 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 602 AVStream *st; |
603 uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; | 603 uint64_t size; |
604 uint8_t *buf; | 604 uint8_t *buf; |
605 | |
606 if (c->fc->nb_streams < 1) // will happen with jp2 files | |
607 return 0; | |
608 st= c->fc->streams[c->fc->nb_streams-1]; | |
609 size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; | |
605 if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) | 610 if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) |
606 return -1; | 611 return -1; |
607 buf= av_realloc(st->codec->extradata, size); | 612 buf= av_realloc(st->codec->extradata, size); |
608 if(!buf) | 613 if(!buf) |
609 return -1; | 614 return -1; |