PR #21400 opened by michaelni URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21400 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21400.patch
Fixes: YWH-PGM40646-10 Redirects did not have their protocol checked, this patchset ensures they are within the white/black lists and also are only http / https >From 13af9a614ae2524c725e9022b242a527c7d15384 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Tue, 6 Jan 2026 23:29:18 +0100 Subject: [PATCH 1/2] avformat/http: Check that the protocol of redirects is http or https Fixes: YWH-PGM40646-10 Signed-off-by: Michael Niedermayer <[email protected]> --- libavformat/http.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index bd25a45636..58c704a7ad 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -253,7 +253,11 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) if (err < 0) goto end; } + } else if (strcmp(proto, "http")) { + err = AVERROR(EINVAL); + goto end; } + if (port < 0) port = 80; -- 2.49.1 >From 032b0a2ff54bb79f323465a84786da7a3331e17d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Tue, 6 Jan 2026 23:30:47 +0100 Subject: [PATCH 2/2] avformat/http: Check white and blacklists on redirects Noticed while fixing the previous Signed-off-by: Michael Niedermayer <[email protected]> --- libavformat/http.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index 58c704a7ad..6ee498b4df 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -242,6 +242,16 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) proxy_path && av_strstart(proxy_path, "http://", NULL); freeenv_utf8(env_no_proxy); + if (h->protocol_whitelist && av_match_list(proto, h->protocol_whitelist, ',') <= 0) { + av_log(h, AV_LOG_ERROR, "Protocol '%s' not on whitelist '%s'!\n", proto, h->protocol_whitelist); + return AVERROR(EINVAL); + } + + if (h->protocol_blacklist && av_match_list(proto, h->protocol_blacklist, ',') > 0) { + av_log(h, AV_LOG_ERROR, "Protocol '%s' on blacklist '%s'!\n", proto, h->protocol_blacklist); + return AVERROR(EINVAL); + } + if (!strcmp(proto, "https")) { lower_proto = "tls"; use_proxy = 0; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
