Commit ab4e5b6394 for ffmpeg
commit ab4e5b6394136ee8de4fe6104308eae2f3dccf42
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Tue Oct 6 07:08:16 2026 +0200
avformat/rtpenc_vc2hq: Limit picture fragments to 65535 bytes
Fixes: infinite loop
Fixes: 8SQ71eGHsyRR
Infinite loop Replicated through UnModified FFmpeg with a vc2 stream from the vc2 encoder
Found during triage of the security report HRhmcrDPRPyf
diff --git a/libavformat/rtpenc_vc2hq.c b/libavformat/rtpenc_vc2hq.c
index 1cff2af9fd..eb48233598 100644
--- a/libavformat/rtpenc_vc2hq.c
+++ b/libavformat/rtpenc_vc2hq.c
@@ -98,7 +98,7 @@ static int send_picture(AVFormatContext *ctx, const uint8_t *buf, int size, int
size -= frag_len;
while (size > 0) {
- frag_len = FFMIN(rtp_ctx->max_payload_size - 20 /* pl header */, size);
+ frag_len = FFMIN3(rtp_ctx->max_payload_size - 20 /* pl header */, size, UINT16_MAX);
AV_WB16(&info_hdr[ 8], frag_len);
AV_WB16(&info_hdr[10], 1 /* nr. of slices */);
AV_WB16(&info_hdr[12], 0 /* slice x */);