comparison mov.c @ 3078:099c8f03c62e libavformat

protect malloc overflow
author bcoudurier
date Mon, 25 Feb 2008 12:45:59 +0000
parents 507565d7d611
children e9f7c2764298
comparison
equal deleted inserted replaced
3077:507565d7d611 3078:099c8f03c62e
289 st->codec->codec_id= codec_get_id(ff_mp4_obj_type, object_type_id); 289 st->codec->codec_id= codec_get_id(ff_mp4_obj_type, object_type_id);
290 dprintf(c->fc, "esds object type id %d\n", object_type_id); 290 dprintf(c->fc, "esds object type id %d\n", object_type_id);
291 len = mp4_read_descr(c, pb, &tag); 291 len = mp4_read_descr(c, pb, &tag);
292 if (tag == MP4DecSpecificDescrTag) { 292 if (tag == MP4DecSpecificDescrTag) {
293 dprintf(c->fc, "Specific MPEG4 header len=%d\n", len); 293 dprintf(c->fc, "Specific MPEG4 header len=%d\n", len);
294 if((uint64_t)len > (1<<30))
295 return -1;
294 st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); 296 st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
295 if (!st->codec->extradata) 297 if (!st->codec->extradata)
296 return AVERROR(ENOMEM); 298 return AVERROR(ENOMEM);
297 get_buffer(pb, st->codec->extradata, len); 299 get_buffer(pb, st->codec->extradata, len);
298 st->codec->extradata_size = len; 300 st->codec->extradata_size = len;