Skip to content

Commit

Permalink
If we fail to output anything when generating a datagram we should fail
Browse files Browse the repository at this point in the history
If when generating a datagram we are unable to output anything then we are
not making progress and we should fail, otherwise we may get into an
infinite loop (i.e. continually trying to output a datagram and continually
failing to do so in an infinite loop).

Fixes openssl#22412
  • Loading branch information
mattcaswell committed Oct 18, 2023
1 parent cd920f8 commit 15e9a25
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ssl/quic/quic_txp.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,19 @@ int ossl_quic_tx_packetiser_generate(OSSL_QUIC_TX_PACKETISER *txp,
continue;

if (!txp_pkt_init(&pkt[enc_level], txp, enc_level, archetype,
running_total))
running_total)) {
/*
* If this fails this is not a fatal error - it means the geometry
* planning determined there was not enough space for another
* packet. So just proceed with what we've already planned for.
* If this fails it may not be a fatal error - it could mean the
* geometry planning determined there was not enough space for
* another packet. In that case we just proceed with what we've
* already planned for.
*/
break;
if (running_total > 0)
break;

/* We failed to output anything. Treat as an error */
goto out;
}

rc = txp_generate_for_el(txp, &pkt[enc_level],
conn_close_enc_level == enc_level);
Expand Down

0 comments on commit 15e9a25

Please sign in to comment.