mirror of https://git.ffmpeg.org/ffmpeg.git
samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-stable@libav.org
(cherry picked from commit 0e830094ad
)
(cherry picked from commit e9b3abd49890e958c745ea46a9f4f91b6b4baa58)
Conflicts:
libavutil/samplefmt.c
This commit is contained in:
parent
4279e0e8d0
commit
9786c24bb7
|
@ -105,8 +105,11 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
|
|||
return AVERROR(EINVAL);
|
||||
|
||||
/* auto-select alignment if not specified */
|
||||
if (!align)
|
||||
if (!align) {
|
||||
if (nb_samples > INT_MAX - 31)
|
||||
return AVERROR(EINVAL);
|
||||
align = 32;
|
||||
}
|
||||
|
||||
/* check for integer overflow */
|
||||
if (nb_channels > INT_MAX / align ||
|
||||
|
|
Loading…
Reference in New Issue