From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 5A71E4D362 for ; Mon, 17 Nov 2025 15:37:18 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'wR9KKgvdIyqJAEPvyW9U1ahrvTMnWLqylghLlLAC36M=', expected b'tmhFVU7RazNm9zafJJaGk3wbv5tF+IqmC3klBVTqptE=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763393793; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=wR9KKgvdIyqJAEPvyW9U1ahrvTMnWLqylghLlLAC36M=; b=bcDgFpqFATGf7tdZ38dJbIKC+9d68HR4J7PTmCDZTZobmmhYkRD1Kfy0wzV/XVP5fwkyZ 2WU4vhfX2eKw2SnXHjJaw4rXn5crQ2dd3Oy2JzrHka0a2RnRurORZNnsk8TiP2xOwgvwvG9 GXMjHv2TKWuYmMYUz1BGDSbSPLjnMGp0cdy8tcNxaWZEh1A95BGVneGoxs6AxiXxMTk/Gho hIdh2YTL4FxQZTnW/dswSoReHb6nZkgl+bwS8k6xGSX3RRDXaZAL5wh3zBdrrVbaw+dB7zc 2lPkh7Z+BDXbWb7AOSTeykBeaWoBInKMX1u8Zz7nfbPRQAw++KF96cwPByqw== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 34F8468FF40; Mon, 17 Nov 2025 17:36:33 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1763393768; b=ANdfkW8LZxTinAq1+iAyLAN0s71pZb5UpmPpn1PdRb2YWnP1AGPXD5t25LejWFsqV3liu 2oKQg19l9A3LwbqJ7hVCYcYVDiT0NUwYs8FbO02RkXmLu8ZeDHBuIlVg2kxHaSBzEq0C/88 BsEd3QHLT0qNTNa1Ps+YHyJ7XectEc7vCh7n9bGhGhEij9KHpI9iQjRfNPy88ZXlTWLMKcT T0qzF5r/tAEfDM2+8YTHt2ZQxWvAcwJDqMRm+/78MyMvVooAptFXzqdFKkgUfIe++Aynf1y tyVETokk9xWXeFF/qwHI4KjJIMhq51zmu7+WF8WVuxkoXDZQWQeSZbuQ/ZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1763393768; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=2XAuV0Qgp6A1X4gT1CMeznq6qTNRnfGDfopa/F/wvms=; b=BEG8oeKoD1Kx/J8Ch4x50BqXcQ7AwWmxP9Pug4B9PlNcoI65ucKHDBSGZgPFTxvySaUO9 1bn+sEX2DHV7S60FdMb5srFGH9tF38eQ8T9XR2Uyb7At3n5J+gaKw7UG2jVStOSDsfCzwQE rKUahN8gKb457W0AHho6Pa/qC98lz5JsNjvZWY8480QQ/ON/s4nsq/novoc/H6OR0STO1e4 j7vNtzPfEswHcxn894WYXevft3urns4w6D4VT+cqgiwAbmeURGLZv1J/KUXBumpdCE13VjW bJBUePrqqs/CETfKJXYEPWdmw2h1QmmvnFPO+dFAURp74dNPMonts3/ZYaTg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763393760; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=tmhFVU7RazNm9zafJJaGk3wbv5tF+IqmC3klBVTqptE=; b=lJgItBkS29HUDv3NIYqdkm+kgVG4U4II5QhL7i30DheK36zrd9KrQ3dJZvNqjz8Jq5lr2 0G/jHEQ1kGbY+kdnwJA+CI2Bc28ubCFygb/IJyQRrTUaT3iA+iJlSWpdW1k1vaR/Mog0GHY 6F2gK868AOUApDYgHg3XE79vLN3APZJmnhj9neDbJXHWeqjAgmkiEVH988GegK3glxmN5BM UYcIAsl8a5cMCS7qyf+cwZAsB1wkic4gIbiIMAoniBtDZMrEkFJzkq4VISacqRj7piaXg7W P6CRadPHAgc/SEHWkLdYq+r5jU6/z5gMSaFsZsoz9GWqIcQirryXhslesQfA== Received: from 188d6d40ca7a (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 5D7C068FB70 for ; Mon, 17 Nov 2025 17:36:00 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 17 Nov 2025 15:36:00 -0000 Message-ID: <176339376048.25.9425109466636940008@2cb04c0e5124> Message-ID-Hash: QYXFWQTLAVRMECRTAK2OJHDEQJUNIPWE X-Message-ID-Hash: QYXFWQTLAVRMECRTAK2OJHDEQJUNIPWE X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] [7.1] Backport HTTP and RTSP fixes (PR #20943) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Marvin Scholz via ffmpeg-devel Cc: Marvin Scholz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20943 opened by Marvin Scholz (ePirat) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20943 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20943.patch Backports #20541 and #20542 to 7.1. >>From 2730ec798357856ba996ac856b14f8325168ebcd Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Thu, 22 May 2025 20:14:49 +0200 Subject: [PATCH 1/3] avformat/http: Handle IPv6 Zone ID in hostname When using a literal IPv6 address as hostname, it can contain a Zone ID especially in the case of link-local addresses. Sending this to the server in the Host header is not useful to the server and in some cases servers refuse such requests. To prevent any such issues, strip the Zone ID from the address if it's an IPv6 address. This also removes it for the Cookies lookup. Based on a patch by: Daniel N Pettersson (cherry picked from commit 5cb6d2221a6d4c07453b6c301ecfcaed48402680) Signed-off-by: Marvin Scholz --- libavformat/http.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index ec60bc0b17..7fab487c58 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -22,6 +22,7 @@ #include "config.h" #include "config_components.h" +#include #include #if CONFIG_ZLIB #include @@ -212,7 +213,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) const char *path, *proxy_path, *lower_proto = "tcp", *local_path; char *env_http_proxy, *env_no_proxy; char *hashmark; - char hostname[1024], hoststr[1024], proto[10]; + char hostname[1024], hoststr[1024], proto[10], tmp_host[1024]; char auth[1024], proxyauth[1024] = ""; char path1[MAX_URL_SIZE], sanitized_path[MAX_URL_SIZE + 1]; char buf[1024], urlbuf[MAX_URL_SIZE]; @@ -222,7 +223,14 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) av_url_split(proto, sizeof(proto), auth, sizeof(auth), hostname, sizeof(hostname), &port, path1, sizeof(path1), s->location); - ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL); + + av_strlcpy(tmp_host, hostname, sizeof(tmp_host)); + // In case of an IPv6 address, we need to strip the Zone ID, + // if any. We do it at the first % sign, as percent encoding + // can be used in the Zone ID itself. + if (strchr(tmp_host, ':')) + tmp_host[strcspn(tmp_host, "%")] = '\0'; + ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, tmp_host, port, NULL); env_http_proxy = getenv_utf8("http_proxy"); proxy_path = s->http_proxy ? s->http_proxy : env_http_proxy; -- 2.49.1 >>From 416d6ca120c9cea8feee96eb6418ec0465cff444 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Fri, 22 Aug 2025 16:50:34 +0200 Subject: [PATCH 2/3] avformat/rtsp: do not log invalid values When reading fails the first time, ch would be uninitialized and printed in the log message. Instead check for an error early and log it properly. (cherry picked from commit 2ed47ab72509bbee60288d245a0aebb7eb05e41a) Signed-off-by: Marvin Scholz --- libavformat/rtsp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5ea471b40c..5e63383b68 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1205,9 +1205,12 @@ start: q = buf; for (;;) { ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1); + if (ret != 1) { + ret = (ret < 0) ? ret : AVERROR(EIO); + av_log(s, AV_LOG_WARNING, "Failed reading RTSP data: %s\n", av_err2str(ret)); + return ret; + } av_log(s, AV_LOG_TRACE, "ret=%d c=%02x [%c]\n", ret, ch, ch); - if (ret != 1) - return ret < 0 ? ret : AVERROR(EIO); if (ch == '\n') break; if (ch == '$' && q == buf) { -- 2.49.1 >>From 95170b06c335531da1ca304220f6a6e4052f6328 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Fri, 22 Aug 2025 21:41:26 +0200 Subject: [PATCH 3/3] avformat/rtsp: fix leading space in RTSP reason When parsing the RTSP message reason, the whole remainder after parsing the status code was used, which would lead to a leading space in the parsed reason string. (cherry picked from commit e63e040f0cef2d6af2fb57aefa6250fc450fa049) Signed-off-by: Marvin Scholz --- libavformat/rtsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5e63383b68..3ccbb1b379 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1240,6 +1240,7 @@ start: if (!strncmp(buf1, "RTSP/", 5)) { get_word(buf1, sizeof(buf1), &p); reply->status_code = atoi(buf1); + p += strspn(p, SPACE_CHARS); av_strlcpy(reply->reason, p, sizeof(reply->reason)); } else { av_strlcpy(reply->reason, buf1, sizeof(reply->reason)); // method -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org