Commit dbf8765c37 for openssl.org

commit dbf8765c37a68158ee7991d0cff56cab8c5128ca
Author: Andrew Dinh <andrewd@openssl.org>
Date:   Mon Aug 3 12:19:29 2026 +0700

    Port script_50

    Assisted-by: Claude:claude-sonnet-5
    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Reviewed-by: Norbert Pocs <norbertp@openssl.org>
    Merge-date: Tue Sep 15 08:51:19 2026
    Merged-from: https://github.com/openssl/openssl/pull/32469

diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index e8d50a6be1..7c18b7cb43 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2573,99 +2573,6 @@ static const struct script_op script_45[] = {
 };

 /* 46. Fault injection - ACK - malformed initial range */
-static int script_46_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr,
-    unsigned char *buf, size_t len)
-{
-    int ok = 0;
-    WPACKET wpkt;
-    unsigned char frame_buf[16];
-    size_t written;
-    uint64_t type = 0, largest_acked = 0, first_range = 0, range_count = 0;
-    uint64_t agap = 0, alen = 0;
-    uint64_t ect0 = 0, ect1 = 0, ecnce = 0;
-
-    if (h->inject_word0 == 0)
-        return 1;
-
-    if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf,
-            sizeof(frame_buf), 0)))
-        return 0;
-
-    type = OSSL_QUIC_FRAME_TYPE_ACK_WITHOUT_ECN;
-
-    switch (h->inject_word0) {
-    case 1:
-        largest_acked = 100;
-        first_range = 101;
-        range_count = 0;
-        break;
-    case 2:
-        largest_acked = 100;
-        first_range = 80;
-        /* [20..100]; [0..18]  */
-        range_count = 1;
-        agap = 0;
-        alen = 19;
-        break;
-    case 3:
-        largest_acked = 100;
-        first_range = 80;
-        range_count = 1;
-        agap = 18;
-        alen = 1;
-        break;
-    case 4:
-        type = OSSL_QUIC_FRAME_TYPE_ACK_WITH_ECN;
-        largest_acked = 100;
-        first_range = 1;
-        range_count = 0;
-        break;
-    case 5:
-        type = OSSL_QUIC_FRAME_TYPE_ACK_WITH_ECN;
-        largest_acked = 0;
-        first_range = 0;
-        range_count = 0;
-        ect0 = 0;
-        ect1 = 50;
-        ecnce = 200;
-        break;
-    }
-
-    h->inject_word0 = 0;
-
-    if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, type))
-        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, largest_acked))
-        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, /*ack_delay=*/0))
-        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, /*ack_range_count=*/range_count))
-        || !TEST_true(WPACKET_quic_write_vlint(&wpkt, /*first_ack_range=*/first_range)))
-        goto err;
-
-    if (range_count > 0)
-        if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, /*range[0].gap=*/agap))
-            || !TEST_true(WPACKET_quic_write_vlint(&wpkt, /*range[0].len=*/alen)))
-            goto err;
-
-    if (type == OSSL_QUIC_FRAME_TYPE_ACK_WITH_ECN)
-        if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, ect0))
-            || !TEST_true(WPACKET_quic_write_vlint(&wpkt, ect1))
-            || !TEST_true(WPACKET_quic_write_vlint(&wpkt, ecnce)))
-            goto err;
-
-    if (!TEST_true(WPACKET_get_total_written(&wpkt, &written)))
-        goto err;
-
-    if (!qtest_fault_prepend_frame(h->qtf, frame_buf, written))
-        goto err;
-
-    ok = 1;
-err:
-    if (ok)
-        WPACKET_finish(&wpkt);
-    else
-        WPACKET_cleanup(&wpkt);
-    return ok;
-}
-
 static const struct script_op script_46[] = {
     /* test moved to test/radix/quic_tests.c */
     OP_END
@@ -2691,23 +2598,7 @@ static const struct script_op script_49[] = {

 /* 50. Fault injection - ACK - duplicate PN */
 static const struct script_op script_50[] = {
-    OP_S_SET_INJECT_PLAIN(script_46_inject_plain),
-    OP_C_SET_ALPN("ossltest"),
-    OP_C_CONNECT_WAIT(),
-
-    OP_C_WRITE(DEFAULT, "apple", 5),
-    OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
-    OP_S_READ_EXPECT(a, "apple", 5),
-
-    OP_BEGIN_REPEAT(2),
-
-    OP_SET_INJECT_WORD(5, 0),
-
-    OP_S_WRITE(a, "Strawberry", 10),
-    OP_C_READ_EXPECT(DEFAULT, "Strawberry", 10),
-
-    OP_END_REPEAT(),
-
+    /* test moved to test/radix/quic_tests.c */
     OP_END
 };

diff --git a/test/radix/quic_tests.c b/test/radix/quic_tests.c
index 3951c5db2f..616979b701 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -3086,8 +3086,26 @@ DEF_SCRIPT(script_49, "Fault injection - ACK - fictional PN")
     OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_PROTOCOL_VIOLATION, 0, 0);
 }

-DEF_SCRIPT(script_50, "place holder for multistrem script_50")
+/* 50. Fault injection - ACK - duplicate PN */
+DEF_SCRIPT(script_50, "Fault injection - ACK - duplicate PN")
 {
+    size_t i;
+
+    OP_SIMPLE_PAIR_CONN();
+    OP_ACCEPT_CONN_WAIT(L, S, 0);
+
+    OP_SET_INJECT_PLAIN(S, inject_malformed_ack_plain);
+
+    OP_WRITE(C, "apple", 5);
+    OP_ACCEPT_STREAM_WAIT(S, Sa, 0);
+    OP_READ_EXPECT(Sa, "apple", 5);
+
+    for (i = 0; i < 2; ++i) {
+        OP_SET_INJECT_WORD(5, 0);
+
+        OP_WRITE(Sa, "Strawberry", 10);
+        OP_READ_EXPECT(C, "Strawberry", 10);
+    }
 }

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