[FFmpeg-cvslog] avformat/mxfdec: use av_realloc_array()

Michael Niedermayer git at videolan.org
Wed Sep 11 13:49:04 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Sep 11 13:34:25 2013 +0200| [c5714097eb4c5545f41b5dcb522f7d7470d6f733] | committer: Michael Niedermayer

avformat/mxfdec: use av_realloc_array()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5714097eb4c5545f41b5dcb522f7d7470d6f733
---

 libavformat/mxfdec.c |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 29a2f56..e8ee741 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -433,10 +433,7 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
     uint64_t footer_partition;
     uint32_t nb_essence_containers;
 
-    if (mxf->partitions_count+1 >= UINT_MAX / sizeof(*mxf->partitions))
-        return AVERROR(ENOMEM);
-
-    tmp_part = av_realloc(mxf->partitions, (mxf->partitions_count + 1) * sizeof(*mxf->partitions));
+    tmp_part = av_realloc_array(mxf->partitions, mxf->partitions_count + 1, sizeof(*mxf->partitions));
     if (!tmp_part)
         return AVERROR(ENOMEM);
     mxf->partitions = tmp_part;
@@ -563,9 +560,8 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
 static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
 {
     MXFMetadataSet **tmp;
-    if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))
-        return AVERROR(ENOMEM);
-    tmp = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets));
+
+    tmp = av_realloc_array(mxf->metadata_sets, mxf->metadata_sets_count + 1, sizeof(*mxf->metadata_sets));
     if (!tmp)
         return AVERROR(ENOMEM);
     mxf->metadata_sets = tmp;



More information about the ffmpeg-cvslog mailing list