]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix SSL_write_[ex|ex2] on blocking quic streams
authorNeil Horman <nhorman@openssl.org>
Tue, 19 Nov 2024 16:58:30 +0000 (11:58 -0500)
committerTomas Mraz <tomas@openssl.org>
Thu, 21 Nov 2024 15:04:14 +0000 (16:04 +0100)
commit7c09ce374c4fc380f7a1da44e574582d5a8bdcff
treeb7ddf291d0adc37dff01b92a7d9b6946d65c9bc0
parent9a1b54b937fec23876644c8752bc1cb95f89f4b6
Fix SSL_write_[ex|ex2] on blocking quic streams

When writing to a blocking quic stream, we sometimes get duplicate
transmitted data.  This occurs when a call to quic_write_blocking has to
wait for space to become available in the ring buffer.  When we do a
wait, the call sets *written to the value returned in args.total_written
as filled out by the calls to block_until_pred->quic_write_again.
However, the value there is based on the amount we requested, which is
only the remaining data that we didn't append in xso_sstream_write.  So
if we call quic_write_blocking with a buffer of length X, and initially
append Y bytes, and write the remainig X-Y bytes via a block_until_pred
call, then *written will return with the value X-Y, even though we wrote
the full X bytes to the ring buffer.

Fix it by recording the initial amount appended into *written, and then
add the args.total_written value if we have to wait on more space

Fixes openssl/project#924

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/26023)

(cherry picked from commit 2de7e1d69851a363cadd9d6bdd95302b89a4383b)
ssl/quic/quic_impl.c