1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avformat/librist: honor the caller buffer size in librist_read

librist_read() ignored its size argument and copied the full payload_len,
overflowing a smaller destination (e.g. via the async: wrapper). Clamp the
copy to the caller-provided buffer size.

Fixes: out of array access
(cherry picked from commit 1c10bcc2e1)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Joshua Rogers
2026-08-04 12:11:55 +00:00
committed by Michael Niedermayer
parent 5907f16395
commit 4e1b9a41ba

View File

@@ -226,7 +226,7 @@ static int librist_read(URLContext *h, uint8_t *buf, int size)
}
}
size = data_block->payload_len;
size = FFMIN(data_block->payload_len, size);
memcpy(buf, data_block->payload, size);
out_free:
rist_receiver_data_block_free2(&data_block);