# HG changeset patch # User bcoudurier # Date 1191848808 0 # Node ID 960795567b33d1da72122826d9ec0d17d31a63f3 # Parent 577c8b1dafccf59ad6217d925d76cb6f1db8ac8a append extradata atoms when parsing, fix OLOCOONS_O3.mov diff -r 577c8b1dafcc -r 960795567b33 mov.c --- a/mov.c Mon Oct 08 11:27:18 2007 +0000 +++ b/mov.c Mon Oct 08 13:06:48 2007 +0000 @@ -470,16 +470,19 @@ static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; - if((uint64_t)atom.size > (1<<30)) + uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; + uint8_t *buf; + if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) + return -1; + buf= av_realloc(st->codec->extradata, size); + if(!buf) return -1; - av_free(st->codec->extradata); - st->codec->extradata_size = atom.size + 8; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (st->codec->extradata) { - AV_WL32(st->codec->extradata + 4, atom.type); - get_buffer(pb, st->codec->extradata + 8, atom.size); - } else - url_fskip(pb, atom.size); + st->codec->extradata= buf; + buf+= st->codec->extradata_size; + st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; + AV_WB32( buf , atom.size + 8); + AV_WL32( buf + 4, atom.type); + get_buffer(pb, buf + 8, atom.size); return 0; }