Commit c8d08d783a for openssl.org
commit c8d08d783ad72601b54f08c1a8bc43ed8a1804a9
Author: Nikolas Gauder <nikolas.gauder@tum.de>
Date: Fri May 29 14:56:39 2026 +0200
quic: add lhash insert error checks
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Wed Jun 10 11:23:37 2026
(Merged from https://github.com/openssl/openssl/pull/31333)
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
index df2b9fa0e3..1efc149119 100644
--- a/ssl/quic/quic_impl.c
+++ b/ssl/quic/quic_impl.c
@@ -5405,6 +5405,11 @@ int ossl_quic_set_peer_token(SSL_CTX *ctx, BIO_ADDR *peer,
ossl_quic_free_peer_token(old);
}
lh_QUIC_TOKEN_insert(c->cache, tok);
+ if (lh_QUIC_TOKEN_error(c->cache)) {
+ ossl_quic_free_peer_token(tok);
+ ossl_crypto_mutex_unlock(c->mutex);
+ return 0;
+ }
ossl_crypto_mutex_unlock(c->mutex);
return 1;
diff --git a/ssl/quic/quic_stream_map.c b/ssl/quic/quic_stream_map.c
index b3244722ff..f707bf71d8 100644
--- a/ssl/quic/quic_stream_map.c
+++ b/ssl/quic/quic_stream_map.c
@@ -173,6 +173,10 @@ QUIC_STREAM *ossl_quic_stream_map_alloc(QUIC_STREAM_MAP *qsm,
s->send_final_size = UINT64_MAX;
lh_QUIC_STREAM_insert(qsm->map, s);
+ if (lh_QUIC_STREAM_error(qsm->map)) {
+ OPENSSL_free(s);
+ return NULL;
+ }
return s;
}