1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

protect realloc overflow

Originally committed as revision 18088 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2009-03-21 00:50:51 +00:00
parent b9b4fc5e07
commit b4800b8b7d

View File

@ -364,6 +364,8 @@ static int mxf_read_primer_pack(MXFContext *mxf)
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
{ {
if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))
return AVERROR(ENOMEM);
mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets)); mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets));
if (!mxf->metadata_sets) if (!mxf->metadata_sets)
return -1; return -1;