Commit 0ffea356 authored by James Almer's avatar James Almer

avformat/utils: check for overflow before reallocating side data

This makes av_stream_add_side_data() consistent with av_packet_add_side_data().
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 2343f23e
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment