History

Revert "avformat/tls_openssl: properly get new BIO index"

BIO_get_new_index() is static counter meant to get index for custom bio type definition. As we can read in the documentation: > Note that BIO_get_new_index() can only be used 127 times before it > returns an error. We cannot call it repeatedly, because it will fail eventually. To my understanding the index is not needed in our use and we could safely use BIO_TYPE_NONE. Documentation states: > type can be set to either BIO_TYPE_NONE or via BIO_get_new_index() if > a unique type is required for searching (See BIO_find_type(3)) We don't use any search related functions. This reverts commit 816dad231f5b312fd98e81cc6a6cbaf47c1e26a5. Fixes: https://github.com/mpv-player/mpv/issues/16589

Kacper Michajłow committed 1 year ago

Commit daee46e1 parent f09c8341 file · +4 −14Browse files

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/tls_openssl.c+4−14
@@ -659,14 +659,11 @@ static int url_bio_bputs(BIO *b, const char *str) · 658 unmodified lines
659659 return url_bio_bwrite(b, str, strlen(str));
660660 }
661661
662−static av_cold int init_bio_method(URLContext *h)
662+static av_cold void init_bio_method(URLContext *h)
663663 {
664664 TLSContext *p = h->priv_data;
665665 BIO *bio;
666− int bio_idx = BIO_get_new_index();
667− if (bio_idx == -1)
668− return AVERROR_EXTERNAL;
669− p->url_bio_method = BIO_meth_new(bio_idx | BIO_TYPE_SOURCE_SINK, "urlprotocol bio");
666+ p->url_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "urlprotocol bio");
670667 BIO_meth_set_write(p->url_bio_method, url_bio_bwrite);
671668 BIO_meth_set_read(p->url_bio_method, url_bio_bread);
672669 BIO_meth_set_puts(p->url_bio_method, url_bio_bputs);
@@ -677,7 +674,6 @@ static av_cold int init_bio_method(URLContext *h) · 4 unmodified lines
677674 BIO_set_data(bio, p);
678675
679676 SSL_set_bio(p->ssl, bio, bio);
680− return 0;
681677 }
682678
683679 static void openssl_info_callback(const SSL *ssl, int where, int ret) {
@@ -874,11 +870,7 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary ** · 190 unmodified lines
874870 SSL_set_options(p->ssl, SSL_OP_NO_QUERY_MTU);
875871 SSL_set_mtu(p->ssl, c->mtu);
876872 DTLS_set_link_mtu(p->ssl, c->mtu);
877−
878− ret = init_bio_method(h);
879− if (ret < 0)
880− goto fail;
881−
873+ init_bio_method(h);
882874 if (p->tls_shared.external_sock != 1) {
883875 if ((ret = ff_tls_open_underlying(&p->tls_shared, h, url, options)) < 0) {
884876 av_log(p, AV_LOG_ERROR, "Failed to connect %s\n", url);
@@ -956,9 +948,7 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op · 71 unmodified lines
956948 }
957949 SSL_set_ex_data(p->ssl, 0, p);
958950 SSL_CTX_set_info_callback(p->ctx, openssl_info_callback);
959− ret = init_bio_method(h);
960− if (ret < 0)
961− goto fail;
951+ init_bio_method(h);
962952 if (!c->listen && !c->numerichost) {
963953 // By default OpenSSL does too lax wildcard matching
964954 SSL_set_hostflags(p->ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t