Commit d895e54fff for openssl.org

commit d895e54fffdfbce25bacc6a5aa3eb8aff900ac27
Author: Andrew Dinh <andrewd@openssl.org>
Date:   Sun Jul 19 21:11:31 2026 +0700

    Port script_32

    Assisted-by: Claude:claude-sonnet-5

    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    MergeDate: Wed Aug  5 03:14:17 2026
    (Merged from https://github.com/openssl/openssl/pull/32107)

diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index a3494e009d..a65a48f753 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2299,6 +2299,11 @@ static const struct script_op script_31[] = {
 };

 /* 32. Fault injection - STREAM frame for nonexistent stream */
+static const struct script_op script_32[] = {
+    /* test moved to test/radix/quic_tests.c */
+    OP_END
+};
+
 static int script_32_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr,
     unsigned char *buf, size_t len)
 {
@@ -2364,26 +2369,6 @@ err:
     return ok;
 }

-static const struct script_op script_32[] = {
-    OP_S_SET_INJECT_PLAIN(script_32_inject_plain),
-    OP_C_SET_ALPN("ossltest"),
-    OP_C_CONNECT_WAIT(),
-    OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE),
-
-    OP_S_NEW_STREAM_UNI(a, S_UNI_ID(0)),
-    OP_S_WRITE(a, "apple", 5),
-
-    OP_C_ACCEPT_STREAM_WAIT(a),
-    OP_C_READ_EXPECT(a, "apple", 5),
-
-    OP_SET_INJECT_WORD(C_UNI_ID(0) + 1, 1),
-    OP_S_WRITE(a, "orange", 6),
-
-    OP_C_EXPECT_CONN_CLOSE_INFO(OSSL_QUIC_ERR_STREAM_STATE_ERROR, 0, 0),
-
-    OP_END
-};
-
 /* 33. Fault injection - STREAM frame with illegal offset */
 static const struct script_op script_33[] = {
     OP_S_SET_INJECT_PLAIN(script_32_inject_plain),
diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index 03bd339309..2879884742 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -2189,8 +2189,87 @@ DEF_SCRIPT(script_31, "Fault injection - received STOP_SENDING for nonexistent r
     OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_STREAM_STATE_ERROR, 0, 0);
 }

-DEF_SCRIPT(script_32, "place holder for multistrem script_32")
+/* 32. Fault injection - STREAM frame for nonexistent stream */
+static int inject_stream_data_frame_plain(RADIX_FAULT *fault, QUIC_PKT_HDR *hdr,
+    unsigned char *buf, size_t len)
 {
+    int ok = 0;
+    WPACKET wpkt;
+    unsigned char frame_buf[64];
+    size_t written;
+    uint64_t type = OSSL_QUIC_FRAME_TYPE_STREAM_OFF_LEN, offset, flen, i;
+
+    if (hdr->type != QUIC_PKT_TYPE_1RTT)
+        return 1;
+
+    switch (fault->word1) {
+    default:
+        return 0;
+    case 0:
+        return 1;
+    case 1:
+        offset = 0;
+        flen = 0;
+        break;
+    case 2:
+        offset = (((uint64_t)1) << 62) - 1;
+        flen = 5;
+        break;
+    case 3:
+        offset = 1 * 1024 * 1024 * 1024; /* 1G */
+        flen = 5;
+        break;
+    case 4:
+        offset = 0;
+        flen = 1;
+        break;
+    }
+
+    if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf,
+            sizeof(frame_buf), 0)))
+        return 0;
+
+    if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, type))
+        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, /* stream ID */
+            fault->word0 - 1))
+        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, offset))
+        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, flen)))
+        goto err;
+
+    for (i = 0; i < flen; ++i)
+        if (!TEST_true(WPACKET_put_bytes_u8(&wpkt, 0x42)))
+            goto err;
+
+    if (!TEST_true(WPACKET_get_total_written(&wpkt, &written))
+        || !radix_fault_prepend_frame(fault, frame_buf, written))
+        goto err;
+
+    ok = 1;
+err:
+    if (ok)
+        WPACKET_finish(&wpkt);
+    else
+        WPACKET_cleanup(&wpkt);
+    return ok;
+}
+
+DEF_SCRIPT(script_32, "Fault injection - STREAM frame for nonexistent stream")
+{
+    OP_SIMPLE_PAIR_CONN_ND();
+    OP_ACCEPT_CONN_WAIT_ND(L, S, 0);
+
+    OP_SET_INJECT_PLAIN(S, inject_stream_data_frame_plain);
+
+    OP_NEW_STREAM(S, Sa, SSL_STREAM_FLAG_UNI);
+    OP_WRITE(Sa, "apple", 5);
+
+    OP_ACCEPT_STREAM_WAIT(C, Ca, 0);
+    OP_READ_EXPECT(Ca, "apple", 5);
+
+    OP_SET_INJECT_WORD(C_UNI_ID(0) + 1, 1);
+    OP_WRITE(Sa, "orange", 6);
+
+    OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_STREAM_STATE_ERROR, 0, 0);
 }

 DEF_SCRIPT(script_33, "place holder for multistrem script_33")