diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 35f5a07e4c..e72674c481 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -553,7 +553,7 @@ static int lag_decode_frame(AVCodecContext *avctx, if (!l->rgb_planes) { l->rgb_stride = FFALIGN(avctx->width, 16); - l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes); + l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes + 1); if (!l->rgb_planes) { av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n"); return AVERROR(ENOMEM);