]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC: Use ossl_assert
authorHugo Landau <hlandau@openssl.org>
Thu, 15 Dec 2022 07:07:35 +0000 (07:07 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 13 Jan 2023 13:20:22 +0000 (13:20 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19703)

ssl/quic/quic_channel.c
ssl/quic/quic_reactor.c

index df4ea8385dce41cef6e956d79993216baa8633ce..346ecde6330358a01318f9231c3e3e33ee1998d4 100644 (file)
@@ -1481,8 +1481,9 @@ static int ch_discard_el(QUIC_CHANNEL *ch,
         ossl_ackm_on_pkt_space_discarded(ch->ackm, pn_space);
 
         /* We should still have crypto streams at this point. */
-        assert(ch->crypto_send[pn_space] != NULL);
-        assert(ch->crypto_recv[pn_space] != NULL);
+        if (!ossl_assert(ch->crypto_send[pn_space] != NULL)
+            || !ossl_assert(ch->crypto_recv[pn_space] != NULL))
+            return 0;
 
         /* Get rid of the crypto stream state for the EL. */
         ossl_quic_sstream_free(ch->crypto_send[pn_space]);
index 47255f61edb06ae57b3bdb1cd19da5f09cce3a4e..aa4cff9a1db7887f51504f75e4a848d881570171 100644 (file)
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 #include "internal/quic_reactor.h"
+#include "internal/common.h"
 
 /*
  * Core I/O Reactor Framework
@@ -159,7 +160,8 @@ static int poll_two_fds(int rfd, int rfd_want_read,
     if (wfd > maxfd)
         maxfd = wfd;
 
-    if (rfd == -1 && wfd == -1 && ossl_time_is_infinite(deadline))
+    if (!ossl_assert(rfd != -1 || wfd != -1
+                     || !ossl_time_is_infinite(deadline)))
         /* Do not block forever; should not happen. */
         return 0;
 
@@ -210,7 +212,7 @@ static int poll_two_fds(int rfd, int rfd_want_read,
             ++npfd;
     }
 
-    if (npfd == 0 && ossl_time_is_infinite(deadline))
+    if (!ossl_assert(npfd != 0 || !ossl_time_is_infinite(deadline)))
         /* Do not block forever; should not happen. */
         return 0;