From fb13409aaffc151f602ad357db46052e98ea46e8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 5 Nov 2026 03:41:23 +0100 Subject: [PATCH] avcodec/adpcmenc: encode all samples of a mono ADPCM_MS block with trellis Fixes: use of uninitialized memory Fixes: 98u4sU59NEf4 Fixes: AISLE-2026-0150-00113 Use of uninitialized memory Replicated through UnModified FFmpeg with Valgrind Found-by: Joshua Rogers (AISLE) --- libavcodec/adpcmenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index cd6b330554..fd8ce9e367 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -782,9 +782,9 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (!buf) return AVERROR(ENOMEM); if (channels == 1) { - adpcm_compress_trellis(avctx, samples, buf, &c->status[0], n, + adpcm_compress_trellis(avctx, samples, buf, &c->status[0], 2 * n, channels); - for (int i = 0; i < n; i += 2) + for (int i = 0; i < 2 * n; i += 2) *dst++ = (buf[i] << 4) | buf[i + 1]; } else { adpcm_compress_trellis(avctx, samples, buf,