Commit b34b321b07 for ffmpeg
commit b34b321b07d24114de4b71fdbb944f008d3b7954
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Oct 19 02:23:09 2026 +0200
avformat/rtpenc: Fragment MPEG audio frames that do not fit with the payload header
Fixes: ffmpeg -f lavfi -i sine=d=0.5 -ar 48000 -c:a mp2 -b:a 128k -f rtp -packetsize 396 rtp://127.0.0.1:45111?pkt_size=396
Found during triage of the security report TwYfznAFyatl (#22717)
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index b42a0f2d4b..823e5e2cf2 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -480,7 +480,7 @@ static void rtp_send_mpegaudio(AVFormatContext *s1,
}
/* add the packet */
- if (size > max_packet_size) {
+ if (size > max_packet_size - 4) {
/* big packet: fragment */
count = 0;
while (size > 0) {