Commit 7754fc6aa4 for openssl.org
commit 7754fc6aa4b6bdeec1e360a47fef29266c50f15f
Author: Andrew Dinh <andrewd@openssl.org>
Date: Sat Aug 1 21:29:28 2026 +0700
Port script_42
Assisted-by: Claude:claude-sonnet-5
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Sat Aug 15 16:49:54 2026
(Merged from https://github.com/openssl/openssl/pull/32236)
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index cd9136c16f..d4819ba2fe 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -2549,61 +2549,8 @@ static const struct script_op script_41[] = {
};
/* 42. Fault injection - CRYPTO frame with illegal offset */
-static int script_42_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr,
- unsigned char *buf, size_t len)
-{
- int ok = 0;
- unsigned char frame_buf[64];
- size_t written;
- WPACKET wpkt;
-
- if (h->inject_word0 == 0)
- return 1;
-
- --h->inject_word0;
-
- if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf,
- sizeof(frame_buf), 0)))
- return 0;
-
- if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, OSSL_QUIC_FRAME_TYPE_CRYPTO))
- || !TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1))
- || !TEST_true(WPACKET_quic_write_vlint(&wpkt, 1))
- || !TEST_true(WPACKET_put_bytes_u8(&wpkt, 0x42)))
- 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_42[] = {
- OP_S_SET_INJECT_PLAIN(script_42_inject_plain),
- OP_C_SET_ALPN("ossltest"),
- OP_C_CONNECT_WAIT(),
- OP_C_SET_DEFAULT_STREAM_MODE(SSL_DEFAULT_STREAM_MODE_NONE),
-
- OP_C_NEW_STREAM_BIDI(a, C_BIDI_ID(0)),
- OP_C_WRITE(a, "apple", 5),
-
- OP_S_BIND_STREAM_ID(a, C_BIDI_ID(0)),
- OP_S_READ_EXPECT(a, "apple", 5),
-
- OP_SET_INJECT_WORD(1, (((uint64_t)1) << 62) - 1),
- OP_S_WRITE(a, "orange", 6),
-
- OP_C_EXPECT_CONN_CLOSE_INFO(OSSL_QUIC_ERR_FRAME_ENCODING_ERROR, 0, 0),
-
+ /* 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 05e5ac2d0c..fdd6a5684e 100644
--- a/test/radix/quic_tests.c
+++ b/test/radix/quic_tests.c
@@ -2684,8 +2684,58 @@ DEF_SCRIPT(script_41, "Fault injection - PATH_CHALLENGE yields PATH_RESPONSE")
OP_FUNC(check_path_response_41);
}
-DEF_SCRIPT(script_42, "place holder for multistrem script_42")
+/* 42. Fault injection - CRYPTO frame with illegal offset */
+static int script_42_inject_plain(RADIX_FAULT *fault, QUIC_PKT_HDR *hdr,
+ unsigned char *buf, size_t len)
+{
+ int ok = 0;
+ unsigned char frame_buf[64];
+ size_t written;
+ WPACKET wpkt;
+
+ if (fault->word0 == 0)
+ return 1;
+
+ --fault->word0;
+
+ if (!TEST_true(WPACKET_init_static_len(&wpkt, frame_buf,
+ sizeof(frame_buf), 0)))
+ return 0;
+
+ if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, OSSL_QUIC_FRAME_TYPE_CRYPTO))
+ || !TEST_true(WPACKET_quic_write_vlint(&wpkt, fault->word1))
+ || !TEST_true(WPACKET_quic_write_vlint(&wpkt, 1))
+ || !TEST_true(WPACKET_put_bytes_u8(&wpkt, 0x42))
+ || !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_42, "Fault injection - CRYPTO frame with illegal offset")
{
+ OP_SIMPLE_PAIR_CONN_ND();
+ OP_ACCEPT_CONN_WAIT_ND(L, S, 0);
+
+ OP_SET_INJECT_PLAIN(S, script_42_inject_plain);
+
+ OP_NEW_STREAM(C, Ca, 0);
+ OP_WRITE(Ca, "apple", 5);
+
+ OP_ACCEPT_STREAM_WAIT(S, Sa, 0);
+ OP_READ_EXPECT(Sa, "apple", 5);
+
+ OP_SET_INJECT_WORD(1, (((uint64_t)1) << 62) - 1);
+ OP_WRITE(Sa, "orange", 6);
+
+ OP_EXPECT_CONN_CLOSE_INFO(C, OSSL_QUIC_ERR_FRAME_ENCODING_ERROR, 0, 0);
}
DEF_SCRIPT(script_43, "place holder for multistrem script_43")