* [FFmpeg-devel] [PR] libavformat/http: Check proto (PR #21400)
@ 2026-01-06 22:44 michaelni via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: michaelni via ffmpeg-devel @ 2026-01-06 22:44 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: michaelni
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 <michael@niedermayer.cc>
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 <michael@niedermayer.cc>
---
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 <michael@niedermayer.cc>
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 <michael@niedermayer.cc>
---
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-06 22:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-06 22:44 [FFmpeg-devel] [PR] libavformat/http: Check proto (PR #21400) michaelni via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git