Try to fix endless loops in quic_multistream_test

The problem seem to be caused by syntax errors due to injected
OSSL_QUIC_FRAME_TYPE_PATH_CHALLENGE packets which are too short
by 8 bytes.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27089)
This commit is contained in:
Bernd Edlinger 2025-03-23 15:20:34 +01:00 committed by Tomas Mraz
parent 289dcbe008
commit ad684e1a6a

View File

@ -2827,7 +2827,7 @@ static int script_21_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr,
{
int ok = 0;
WPACKET wpkt;
unsigned char frame_buf[8];
unsigned char frame_buf[9];
size_t written;
if (h->inject_word0 == 0 || hdr->type != h->inject_word0)
@ -2840,6 +2840,19 @@ static int script_21_inject_plain(struct helper *h, QUIC_PKT_HDR *hdr,
if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, h->inject_word1)))
goto err;
switch (h->inject_word1) {
case OSSL_QUIC_FRAME_TYPE_PATH_CHALLENGE:
if (!TEST_true(WPACKET_put_bytes_u64(&wpkt, (uint64_t)0)))
goto err;
break;
case OSSL_QUIC_FRAME_TYPE_STREAM_DATA_BLOCKED:
if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, (uint64_t)0)))
goto err;
if (!TEST_true(WPACKET_quic_write_vlint(&wpkt, (uint64_t)0)))
goto err;
break;
}
if (!TEST_true(WPACKET_get_total_written(&wpkt, &written)))
goto err;