summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 19f5ae720c..a905838468 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1739,10 +1739,10 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
}
}
- if ((unsigned)st->nb_side_data + 1 >= INT_MAX / sizeof(*st->side_data))
+ if (st->nb_side_data + 1U > FFMIN(INT_MAX, SIZE_MAX / sizeof(*tmp)))
return AVERROR(ERANGE);
- tmp = av_realloc(st->side_data, (st->nb_side_data + 1) * sizeof(*tmp));
+ tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
if (!tmp) {
return AVERROR(ENOMEM);
}