From 2c889aca1b3f792797753d73a94bc0c6f269f526 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 15 Jun 2025 16:49:22 +0200 Subject: tls: Do not trigger assertion after closing connection In HasPending(), we assert that there is an open connection object (ssl), but it seems we can end up calling HasPending() after calling Close(). Therefore, remove the assertion and include ssl != nullptr as the first requirement. Closes: #1107827 --- methods/connect.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index 96c169e79..828be3f50 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -889,12 +889,11 @@ struct TlsFd final : public MethodFd bool HasPending() override { - assert(ssl); // SSL_has_pending() can return 1 even if there are no actual bytes to read // post decoding, so we need to SSL_peek() too to see if there are actual // bytes as otherwise we end up busy looping (tested by DE -> AU https connection) char buf; - return SSL_has_pending(ssl) && SSL_peek(ssl, &buf, 1) > 0; + return ssl != nullptr && SSL_has_pending(ssl) && SSL_peek(ssl, &buf, 1) > 0; } }; -- cgit v1.2.3-70-g09d2