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 F35144B969 for ; Wed, 25 Jun 2025 20:00:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 1637168D7DE; Wed, 25 Jun 2025 22:59:33 +0300 (EEST) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 7EFBD68D79D for ; Wed, 25 Jun 2025 22:59:23 +0300 (EEST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-453749af004so1171455e9.1 for ; Wed, 25 Jun 2025 12:59:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750881563; x=1751486363; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=GEylBvL4oooLBldtz9HJGm/KZCMdFezZagcGafBe5iA=; b=gSqFdi9bPGoub4rX4v+ASMltjB1SJc9ZuXRU9o0PDNLqf3O+vcw1nMqx0bKnftt2EG BHDLMpuDWZJ1Zdr6xNyUWTKE6l3YfqntIsBgwTimUKtMhEMzKuoM17VmyWW6Acpd8MMx PIVGmnXee20wB/hAVSa4wCwZNTrFivMA/JeDN4VupTdtFPzihAGggnmEMQe7kc+evijq J0pOh405mhCO+hKHaWU8UxgHOLKCKXxX8dQDPYUAt2Jv+2to9WQ5eKTsRB0/OE6ikOnx qUnnnBrTJciv10R8YCWuAVE0lB5RYLA1YvFkrAOjaODq7z0NXrMCZqx4ybZtdmT95bGa t57w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750881563; x=1751486363; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GEylBvL4oooLBldtz9HJGm/KZCMdFezZagcGafBe5iA=; b=LjJJ7p8Pjw5mHJGAnL+Kuf9ElVm3piutajE9poablyWxg7AcaAVSMlCgbJEj3Bm04e ubcchrQDXDX8fi47jxSCzafDURPjmM1nSRUlmVW7pox/o4om5Sd0N1fvejX8bxb08pZI pJbAY1fpiBIltCsVilcxfRjHLn5Sg6GhhaHGkz97ZkT/Dog54f8yK35Uq7m6CpRmfAj9 34jFbrEb8+LJN3SeX29FPTwagD6vY9xcponK9WRGPO7jKS8R0rxI11bURWb3A47p4Rtz ILfCuoTJLsIk2NASaPu1BrK+GyCDmgjwD9ugdeGHWQloIZ3e799no0iDkO4QnNLpkUSy MXzQ== X-Gm-Message-State: AOJu0Yz+fLte+n3y473CgxCZWSuHqELMgrJEwk44OJcUmRzzuHLJ2SPq bztLJV++slsWwcwq10iHBzIPlWe2AsiNA0w3nwYkEspUlo3g5ul2irvG544DIA== X-Gm-Gg: ASbGncsRf4DaJ/TM4A3F2wbe3YYUTSzkK3epo1xdfd2Gy57Fvdq2G9wxQCJqtmt5CFB fwsb/6Nt8ioBHYRepB+LgcrrbX07l+D7zf2BNvXtx3Tj7W/ulRZQFN+oBLuKK2mVK+1tmim9S6k ojfJg8qguN3GKDUrVIfz979AIPPP+GnfZVTWI2XRqk3ENpakqrSvsNCQkq941jXeHBMIR5vN7tG aRLE76HTzf3pEkHf5FlpY+ubxU5OeQ88MK61H77v+3Yxgrj4AyeWCFBEe5uCYfjfeVlJL51Oncp kP8pwcqOre7g4Kmj841EmC4JaxWUa51INofDo3DhwcOHQ7Eru+3c9YbEElo7jDbvJZhu5948DZb +moDdjlt6Mdi6ejISpSqnasblk9BtUhelgo4RgRH3N0TgpnqdCA7htVIa3wZ2y8H1QXnaYFu1Gr /LJ4iJ X-Google-Smtp-Source: AGHT+IGAYRdHWfu+C2/GVFOzE/Zi5MpP+31CP7ivZudENYxBenxdCdPmrgkvgUIKs9hNQypKQFgNPQ== X-Received: by 2002:a5d:584a:0:b0:3a3:65b5:51d7 with SMTP id ffacd0b85a97d-3a6ed601d8emr3773501f8f.26.1750881562678; Wed, 25 Jun 2025 12:59:22 -0700 (PDT) Received: from ArmedBeast.fritz.box (p2003010237004500c9a67543cc7ba10e.dip0.t-ipconnect.de. [2003:102:3700:4500:c9a6:7543:cc7b:a10e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a6e810977esm5359288f8f.83.2025.06.25.12.59.22 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 25 Jun 2025 12:59:22 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 Jun 2025 21:59:12 +0200 Message-Id: <20250625195916.20276-4-epirat07@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250625195916.20276-1-epirat07@gmail.com> References: <20250625195916.20276-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/8] avformat/tls_openssl: properly get new BIO index X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: As noted in the OpenSSL documentation, BIO_get_new_index must be used to get a new BIO index. This is ORd with the proper type flag BIO_TYPE_SOURCE_SINK. --- libavformat/tls_openssl.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 25991c8c9d..7f796c7ddb 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -613,11 +613,14 @@ static int url_bio_bputs(BIO *b, const char *str) return url_bio_bwrite(b, str, strlen(str)); } -static av_cold void init_bio_method(URLContext *h) +static av_cold int init_bio_method(URLContext *h) { TLSContext *p = h->priv_data; BIO *bio; - p->url_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "urlprotocol bio"); + int bio_idx = BIO_get_new_index(); + if (bio_idx == -1) + return AVERROR_EXTERNAL; + p->url_bio_method = BIO_meth_new(bio_idx | BIO_TYPE_SOURCE_SINK, "urlprotocol bio"); BIO_meth_set_write(p->url_bio_method, url_bio_bwrite); BIO_meth_set_read(p->url_bio_method, url_bio_bread); BIO_meth_set_puts(p->url_bio_method, url_bio_bputs); @@ -628,6 +631,7 @@ static av_cold void init_bio_method(URLContext *h) BIO_set_data(bio, p); SSL_set_bio(p->ssl, bio, bio); + return 0; } static void openssl_info_callback(const SSL *ssl, int where, int ret) { @@ -822,7 +826,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary ** SSL_set_options(p->ssl, SSL_OP_NO_QUERY_MTU); SSL_set_mtu(p->ssl, p->tls_shared.mtu); DTLS_set_link_mtu(p->ssl, p->tls_shared.mtu); - init_bio_method(h); + ret = init_bio_method(h); + if (ret < 0) + goto fail; if (p->tls_shared.use_external_udp != 1) { if ((ret = ff_tls_open_underlying(&p->tls_shared, h, url, options)) < 0) { @@ -911,7 +917,9 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op } SSL_set_ex_data(p->ssl, 0, p); SSL_CTX_set_info_callback(p->ctx, openssl_info_callback); - init_bio_method(h); + ret = init_bio_method(h); + if (ret < 0) + goto fail; if (!c->listen && !c->numerichost) SSL_set_tlsext_host_name(p->ssl, c->host); ret = c->listen ? SSL_accept(p->ssl) : SSL_connect(p->ssl); -- 2.39.5 (Apple Git-154) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".