This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 4a390fcd20 avformat/rtpenc: validate MPEG-TS RTP payload size
4a390fcd20 is described below

commit 4a390fcd2081c198b57c515c9c0b1efde3585fc2
Author:     Devraj Ajmera <[email protected]>
AuthorDate: Tue Mar 3 00:54:40 2026 +0530
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sat Mar 7 12:17:27 2026 +0100

    avformat/rtpenc: validate MPEG-TS RTP payload size
    
    Ensure that the RTP payload size is at least one TS packet
    (188 bytes) when packetizing MPEG-TS.
    
    Previously, small payload sizes were silently rounded up,
    which could lead to incorrect behavior. Return EINVAL
    with a clear error message instead.
    
    Signed-off-by: Devraj Ajmera <[email protected]>
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/rtpenc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 6d8e95f4c3..1d4b00a0f4 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -178,9 +178,16 @@ static int rtp_write_header(AVFormatContext *s1)
     case AV_CODEC_ID_MPEG2VIDEO:
         break;
     case AV_CODEC_ID_MPEG2TS:
+        if (s->max_payload_size < TS_PACKET_SIZE) {
+            av_log(s1, AV_LOG_ERROR,
+                   "RTP payload size %u too small for MPEG-TS "
+                   "(minimum %d bytes required)\n",
+                   s->max_payload_size, TS_PACKET_SIZE);
+            ret = AVERROR(EINVAL);
+            goto fail;
+        }
+
         n = s->max_payload_size / TS_PACKET_SIZE;
-        if (n < 1)
-            n = 1;
         s->max_payload_size = n * TS_PACKET_SIZE;
         break;
     case AV_CODEC_ID_DIRAC:

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to