QUIC TEST: Coverity - Ensure stream names are non-NULL
authorHugo Landau <hlandau@openssl.org>
Thu, 27 Jul 2023 14:56:19 +0000 (15:56 +0100)
committerHugo Landau <hlandau@openssl.org>
Thu, 10 Aug 2023 17:19:50 +0000 (18:19 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21565)

test/quic_multistream_test.c

index fbe47b488500d0db832161e5d4a8cddfe98aad70..eef32d4f5806447e168dd3d059f6e76869dde0b8 100644 (file)
@@ -1126,6 +1126,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_ptr_null(c_tgt))
                     goto out; /* don't overwrite existing stream with same name */
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (!TEST_ptr(c_stream = ossl_quic_detach_stream(h->c_conn)))
                     goto out;
 
@@ -1139,6 +1142,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_ptr(c_tgt))
                     goto out;
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (!TEST_true(ossl_quic_attach_stream(h->c_conn, c_tgt)))
                     goto out;
 
@@ -1155,6 +1161,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_ptr_null(c_tgt))
                     goto out; /* don't overwrite existing stream with same name */
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (op->arg1 != 0)
                     flags |= SSL_STREAM_FLAG_UNI;
 
@@ -1178,6 +1187,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_uint64_t_eq(s_stream_id, UINT64_MAX))
                     goto out; /* don't overwrite existing stream with same name */
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (!TEST_true(ossl_quic_tserver_stream_new(h->s,
                                                             op->arg1 > 0,
                                                             &stream_id)))
@@ -1200,6 +1212,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_ptr_null(c_tgt))
                     goto out; /* don't overwrite existing stream with same name */
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if ((c_stream = SSL_accept_stream(h->c_conn, 0)) == NULL)
                     SPIN_AGAIN();
 
@@ -1216,6 +1231,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_uint64_t_eq(s_stream_id, UINT64_MAX))
                     goto out;
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 new_stream_id = ossl_quic_tserver_pop_incoming_stream(h->s);
                 if (new_stream_id == UINT64_MAX)
                     SPIN_AGAIN();
@@ -1242,6 +1260,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                     || !TEST_true(!SSL_is_connection(c_tgt)))
                     goto out;
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (!TEST_true(helper_local_set_c_stream(&hl, op->stream_name, NULL)))
                     goto out;
 
@@ -1340,6 +1361,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_uint64_t_eq(s_stream_id, UINT64_MAX))
                     goto out;
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (!TEST_true(helper_set_s_stream(h, op->stream_name, op->arg2)))
                     goto out;
             }
@@ -1350,6 +1374,9 @@ static int run_script_worker(struct helper *h, const struct script_op *script,
                 if (!TEST_uint64_t_ne(s_stream_id, UINT64_MAX))
                     goto out;
 
+                if (!TEST_ptr(op->stream_name))
+                    goto out;
+
                 if (!TEST_true(helper_set_s_stream(h, op->stream_name, UINT64_MAX)))
                     goto out;
             }