diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-10-08 13:06:48 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2007-10-08 13:06:48 +0000 |
commit | 68bc33fa9fe3d5ca56884b605383b9fbdd328b72 (patch) | |
tree | 7e78077f3b40cec09fca89945afcd7056b4d9f85 | |
parent | 6cb1d36169e31e5c51e80525deb95b89e7d08b9d (diff) | |
download | ffmpeg-68bc33fa9fe3d5ca56884b605383b9fbdd328b72.tar.gz |
append extradata atoms when parsing, fix OLOCOONS_O3.mov
Originally committed as revision 10688 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mov.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index c9de693df0..e9b6c761f4 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -470,16 +470,19 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) 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; - 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); + buf= av_realloc(st->codec->extradata, size); + if(!buf) + return -1; + 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; } |