diff --git a/libavcodec/libcodec2.c b/libavcodec/libcodec2.c index 8895865721..ca74b2beb6 100644 --- a/libavcodec/libcodec2.c +++ b/libavcodec/libcodec2.c @@ -132,6 +132,8 @@ static int libcodec2_decode(AVCodecContext *avctx, AVFrame *frame, int16_t *output; nframes = pkt->size / avctx->block_align; + if (nframes > INT_MAX / avctx->frame_size) + return AVERROR_INVALIDDATA; frame->nb_samples = avctx->frame_size * nframes; ret = ff_get_buffer(avctx, frame, 0);