On 11/03/2026 18:00, devraj ajmera via ffmpeg-devel wrote:
Ensure that the RTP payload type is within the valid
range defined by the RTP specification (0-127).

Invalid payload types could otherwise lead to
incorrect RTP packet construction.

Signed-off-by: Devraj Ajmera <[email protected]>
---
  libavformat/rtpenc.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 1d4b00a0f4..153ba25257 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -113,6 +113,13 @@ static int rtp_write_header(AVFormatContext *s1)
          return -1;
      }
+ if (s->payload_type > 127) {
+        av_log(s1, AV_LOG_ERROR,
+               "Invalid RTP payload type %d (must be 0-127)\n",
+               s->payload_type);
+        return AVERROR(EINVAL);
+    }
+
      if (s->payload_type < 0) {
          /* Re-validate non-dynamic payload types */
          if (st->id < RTP_PT_PRIVATE)

Patch looks sensible to me. But I don't know the RTP spec by heart, so that is assuming this is correct per the spec.

You could try posting it on Forgejo, and with a direct link to the spec if that's publicly available, to speed review up.
_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to