avcodec/pcm-dvdenc: do not encode a frame with fewer samples than a block

24 bit samples are stored in blocks of samples_per_block samples
and the sample count of a frame is rounded down to whole blocks. A last
frame with fewer samples than a block gives zero blocks, the do/while
loops still run and read past the frame until the block count wraps.

Return no packet for such a frame.

Fixes: out of array read
Fixes: ZplUzGvg2XP9
Fixes: AISLE-2026-0150-00112
Out of array read Replicated through UnModified FFmpeg with ASAN

Found-by: Joshua Rogers (AISLE)
This commit is contained in:
Michael Niedermayer authored and michaelni committed 2026-11-05 23:01:56 +00:00
1 parent f1205ee018
commit cfe6a6cd7d
1 file changed
+3
+3
View File
@@ -123,6 +123,9 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
PutByteContext pb;
int ret;
if (!blocks)
return 0;
if ((ret = ff_get_encode_buffer(avctx, avpkt, pkt_size, 0)) < 0)
return ret;