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 9cf34b031f avformat/rtpdec: propagate SRTP setup errors to the caller
9cf34b031f is described below
commit 9cf34b031f489dcecad5c579d0a22a956918cf36
Author: Thomas Devoogdt <[email protected]>
AuthorDate: Thu Jul 16 19:26:50 2026 +0200
Commit: Marvin Scholz <[email protected]>
CommitDate: Wed Sep 16 17:05:34 2026 +0000
avformat/rtpdec: propagate SRTP setup errors to the caller
ff_rtp_parse_set_crypto() was void and dropped the ff_srtp_set_crypto()
return value. A rejected crypto suite therefore left srtp_enabled clear
while RTSPStream.crypto_suite stayed set, and rtsp.c uses crypto_suite[0]
as the sole guard for secure transport. The session could thus be
negotiated as SRTP while the RTP actually went out unprotected.
Return the error instead and let ff_rtsp_open_transport_ctx() abort SETUP
rather than continue with a half-initialised SRTP context.
Signed-off-by: Thomas Devoogdt <[email protected]>
---
libavformat/rtpdec.c | 11 +++++++----
libavformat/rtpdec.h | 4 ++--
libavformat/rtsp.c | 15 +++++++++++----
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 3fd817f93c..8842e636ad 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -584,11 +584,14 @@ void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext
*s, PayloadContext *ctx,
s->handler = handler;
}
-void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite,
- const char *params)
+int ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite,
+ const char *params)
{
- if (!ff_srtp_set_crypto(&s->srtp, suite, params))
- s->srtp_enabled = 1;
+ int ret = ff_srtp_set_crypto(&s->srtp, suite, params);
+ if (ret < 0)
+ return ret;
+ s->srtp_enabled = 1;
+ return 0;
}
static int rtp_set_prft(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp)
{
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index c06f44b86c..0c2a293c9b 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -45,8 +45,8 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1,
AVStream *st,
int payload_type, int queue_size);
void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
const RTPDynamicProtocolHandler
*handler);
-void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite,
- const char *params);
+int ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite,
+ const char *params);
int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
uint8_t **buf, int len);
void ff_rtp_parse_close(RTPDemuxContext *s);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b6f58f3102..51754f5d26 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -916,10 +916,17 @@ int ff_rtsp_open_transport_ctx(AVFormatContext *s,
RTSPStream *rtsp_st)
rtsp_st->dynamic_protocol_context,
rtsp_st->dynamic_handler);
}
- if (rtsp_st->crypto_suite[0])
- ff_rtp_parse_set_crypto(rtsp_st->transport_priv,
- rtsp_st->crypto_suite,
- rtsp_st->crypto_params);
+ if (rtsp_st->crypto_suite[0]) {
+ int ret = ff_rtp_parse_set_crypto(rtsp_st->transport_priv,
+ rtsp_st->crypto_suite,
+ rtsp_st->crypto_params);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR,
+ "SRTP setup failed for suite '%s'\n",
+ rtsp_st->crypto_suite);
+ return ret;
+ }
+ }
}
return 0;
--
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]