summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 19bb8bd420..9d01babaf4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5121,7 +5121,10 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
}
}
- tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
+ if ((unsigned)st->nb_side_data + 1 >= INT_MAX / sizeof(*st->side_data))
+ return AVERROR(ERANGE);
+
+ tmp = av_realloc(st->side_data, st->nb_side_data + 1 * sizeof(*tmp));
if (!tmp) {
return AVERROR(ENOMEM);
}