---
libavformat/mxfdec.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index a68b1a4..42bb21f 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1232,9 +1232,8 @@ static int mxf_compute_index_tables(MXFContext *mxf)
}
}
- if (mxf->nb_index_tables > INT_MAX / sizeof(MXFIndexTable) ||
- !(mxf->index_tables = av_mallocz(mxf->nb_index_tables *
- sizeof(MXFIndexTable)))) {
+ if (!(mxf->index_tables = av_mallocz_array(mxf->nb_index_tables,
+ sizeof(MXFIndexTable)))) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n");
ret = AVERROR(ENOMEM);
goto finish_decoding_index;
@@ -1253,12 +1252,10 @@ static int mxf_compute_index_tables(MXFContext *mxf)
for (i = j = 0; j < mxf->nb_index_tables; i +=
mxf->index_tables[j++].nb_segments) {
MXFIndexTable *t = &mxf->index_tables[j];
- if (t->nb_segments >
- (INT_MAX / sizeof(MXFIndexTableSegment *)) ||
- !(t->segments = av_mallocz(t->nb_segments *
- sizeof(MXFIndexTableSegment*)))) {
- av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate
IndexTableSegment"
- " pointer array\n");
+ if (!(t->segments = av_mallocz_array(t->nb_segments,
+ sizeof(MXFIndexTableSegment*)))) {
+ av_log(mxf->fc, AV_LOG_ERROR,
+ "failed to allocate IndexTableSegment pointer array\n");
ret = AVERROR(ENOMEM);
goto finish_decoding_index;
}
--
1.7.8.rc1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel