QUIC APL: Fix incoming default stream popping

Fixes #22106

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22333)
This commit is contained in:
Hugo Landau 2023-10-10 12:19:29 +01:00
parent 91a5c0e40c
commit cd138c33d8
2 changed files with 32 additions and 3 deletions

View File

@ -1836,6 +1836,7 @@ static int qc_wait_for_default_xso_for_read(QCTX *ctx)
QUIC_STREAM *qs;
int res;
struct quic_wait_for_stream_args wargs;
OSSL_RTT_INFO rtt_info;
/*
* If default stream functionality is disabled or we already detached
@ -1890,8 +1891,15 @@ static int qc_wait_for_default_xso_for_read(QCTX *ctx)
}
/*
* We now have qs != NULL. Make it the default stream, creating the
* necessary XSO.
* We now have qs != NULL. Remove it from the incoming stream queue so that
* it isn't also returned by any future SSL_accept_stream calls.
*/
ossl_statm_get_rtt_info(ossl_quic_channel_get_statm(qc->ch), &rtt_info);
ossl_quic_stream_map_remove_from_accept_queue(ossl_quic_channel_get_qsm(qc->ch),
qs, rtt_info.smoothed_rtt);
/*
* Now make qs the default stream, creating the necessary XSO.
*/
qc_set_default_xso(qc, create_xso_from_stream(qc, qs), /*touch=*/0);
if (qc->default_xso == NULL)

View File

@ -4902,6 +4902,26 @@ static const struct script_op script_76[] = {
OP_END
};
static const struct script_op script_77[] = {
OP_C_SET_ALPN ("ossltest")
OP_C_CONNECT_WAIT ()
OP_C_SET_INCOMING_STREAM_POLICY(SSL_INCOMING_STREAM_POLICY_ACCEPT)
OP_S_NEW_STREAM_BIDI (a, S_BIDI_ID(0))
OP_S_WRITE (a, "Strawberry", 10)
OP_C_READ_EXPECT (DEFAULT, "Strawberry", 10)
OP_S_NEW_STREAM_BIDI (b, S_BIDI_ID(1))
OP_S_WRITE (b, "xyz", 3)
OP_C_ACCEPT_STREAM_WAIT (b)
OP_C_READ_EXPECT (b, "xyz", 3)
OP_END
};
static const struct script_op *const scripts[] = {
script_1,
script_2,
@ -4978,7 +4998,8 @@ static const struct script_op *const scripts[] = {
script_73,
script_74,
script_75,
script_76
script_76,
script_77
};
static int test_script(int idx)