Commit 7a55e7d4f3 for ffmpeg
commit 7a55e7d4f3698bb72d26aba8f5a41559f8ee6612
Author: Gyula Sebok <gyula.sbk@gmail.com>
Date: Sat Oct 31 19:18:51 2026 +0100
avcodec/utvideodec: Fix over-read of the add_left_pred source buffer
The buffer only had 8 bytes of padding, while the SIMD versions of
add_left_pred read whole vectors, up to the next multiple of 32 bytes
with AVX2.
Signed-off-by: Gyula Sebok <gyula.sbk@gmail.com>
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index e9321241f0..ddfaa20005 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -30,6 +30,7 @@
#define CACHED_BITSTREAM_READER !ARCH_X86_32
#define UNCHECKED_BITSTREAM_READER 1
+#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
@@ -1057,7 +1058,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
- c->buffer = av_calloc(avctx->width + 8, c->pro?2:1);
+ /* add_left_pred reads whole vectors. */
+ c->buffer = av_calloc(avctx->width + av_cpu_max_align(), c->pro ? 2 : 1);
if (!c->buffer)
return AVERROR(ENOMEM);