]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
txp_generate_stream_frames(): Set stream id in header early enough
authorTomas Mraz <tomas@openssl.org>
Mon, 11 Nov 2024 13:33:57 +0000 (14:33 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 12 Nov 2024 15:56:09 +0000 (16:56 +0100)
Otherwise we will calculate an incorrect header
size for higher stream ids and won't fit the
frame into the packet.

Fixes #25417

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25928)

ssl/quic/quic_txp.c

index 2532d1edcba1874c2c2fd1ff58d792923270ec04..bbbb6a7045208059f79fd7c41daec9d8e8b09652 100644 (file)
@@ -2226,6 +2226,7 @@ static int txp_generate_stream_frames(OSSL_QUIC_TX_PACKETISER *txp,
             rc = 1;
             goto err;
         }
+        chunks[i].shdr.stream_id = id;
     }
 
     for (i = 0;; ++i) {
@@ -2339,7 +2340,6 @@ static int txp_generate_stream_frames(OSSL_QUIC_TX_PACKETISER *txp,
         if (wpkt == NULL)
             goto err; /* alloc error */
 
-        shdr->stream_id = id;
         if (!ossl_assert(ossl_quic_wire_encode_frame_stream_hdr(wpkt, shdr))) {
             /* (Should not be possible.) */
             tx_helper_rollback(h);