]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
h3: fix query of concurrent streams
authorStefan Eissing <stefan@eissing.org>
Thu, 10 Jul 2025 11:18:03 +0000 (13:18 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 10 Jul 2025 15:29:54 +0000 (17:29 +0200)
Queries gave wrong value or ran into NULL pointers when called at
times when connection filter was not fully initialized.

Closes #17886

lib/http2.c
lib/vquic/curl_osslq.c
lib/vquic/curl_quiche.c

index 1f65cbdd0207ebf8689b9801bb41f99f019bb18c..a8f6ae439f4def05fb90c173c04aa3992ad821dc 100644 (file)
@@ -2750,7 +2750,7 @@ static CURLcode cf_h2_query(struct Curl_cfilter *cf,
     DEBUGASSERT(pres1);
 
     CF_DATA_SAVE(save, cf, data);
-    if(nghttp2_session_check_request_allowed(ctx->h2) == 0) {
+    if(!ctx->h2 || !nghttp2_session_check_request_allowed(ctx->h2)) {
       /* the limit is what we have in use right now */
       effective_max = CONN_ATTACHED(cf->conn);
     }
index d64ea836be30d7b502ae3a22b418c974d296036d..ec3a2e0ad0a2588bcfcaa08cd49c7293b8191a03 100644 (file)
@@ -2304,8 +2304,9 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
   case CF_QUERY_MAX_CONCURRENT: {
 #ifdef SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL
     /* Added in OpenSSL v3.3.x */
-    uint64_t v;
-    if(!SSL_get_value_uint(ctx->tls.ossl.ssl, SSL_VALUE_CLASS_GENERIC,
+    uint64_t v = 0;
+    if(ctx->tls.ossl.ssl &&
+       !SSL_get_value_uint(ctx->tls.ossl.ssl, SSL_VALUE_CLASS_GENERIC,
                            SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL, &v)) {
       CURL_TRC_CF(data, cf, "error getting available local bidi streams");
       return CURLE_HTTP3;
index 0ac389d541705b9d6edfeda5e0f287a49ea91064..c4331c46bb80d807a8e522c60c5e6f6b726170eb 100644 (file)
@@ -1516,7 +1516,7 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
   switch(query) {
   case CF_QUERY_MAX_CONCURRENT: {
     curl_uint64_t max_streams = CONN_ATTACHED(cf->conn);
-    if(!ctx->goaway) {
+    if(!ctx->goaway && ctx->qconn) {
       max_streams += quiche_conn_peer_streams_left_bidi(ctx->qconn);
     }
     *pres1 = (max_streams > INT_MAX) ? INT_MAX : (int)max_streams;