avcodec/pcm-bluray: copy only whole samples on big-endian hosts

Copy the same number of bytes the little-endian path consumes; the
remaining bytes are left to the next call, which rejects them.

Fixes: 6zek0xDeEzFA
Regression since: bc057f7592
Fixes: heap buffer overflow
Heap buffer overflow write Replicated through UnModified FFmpeg with a guard page allocator (big-endian s390x build under qemu-user)

Found during review of PR #23393
This commit is contained in:
Michael Niedermayer authored and Marvin Scholz committed 2026-11-05 15:01:11 +00:00
1 parent 799f1dfaf7
commit a61b32df3f
1 file changed
+1 -1
+1 -1
View File
@@ -167,7 +167,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame,
samples *= num_source_channels;
if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) {
#if HAVE_BIGENDIAN
bytestream2_get_buffer(&gb, (uint8_t*)dst16, buf_size);
bytestream2_get_buffer(&gb, (uint8_t*)dst16, samples * 2);
#else
do {
*dst16++ = bytestream2_get_be16u(&gb);