Repository navigation
Pr/tls codec fixes - #2571
Draft
clementblaudeau wants to merge 17 commits into
Draft
Pr/tls codec fixes#2571clementblaudeau wants to merge 17 commits into
clementblaudeau wants to merge 17 commits into
Conversation
On 64-bit, len_add was a plain `+`: Size sums over aliased data can overflow (debug: panic; release: wrong length prefix). len_add is now pub #[doc(hidden)] (API addition): derive output calls it.
With `mls`, DeserializeBytes accepted varint length prefixes of 2^30 or more (RFC 9420, 2.1.2), which the std path rejects.
…ng vectors In debug builds, serializing a TlsVecU*/TlsByteVecU* whose content does not fit its length field hit a debug_assert! and panicked; release builds returned Err(InvalidVectorLength). The check right after the assert already handles the case.
TlsVarInt::tls_deserialize read its first byte with a single `read`, so a reader returning ErrorKind::Interrupted (documented as retryable) made decoding of TlsVarInt, VLBytes and the types built on them fail. It now uses `read_exact`, which retries; end of input still gives EndOfStream.
… path The next implicit discriminant is a number, exhausted (after the repr's maximum) or unknown (after a path), computed by a small state machine. After a path discriminant only the next variant needs an explicit discriminant; implicit discriminants continue from the next literal. The overflow and out-of-range errors of the implicit discriminant now name the repr's maximum.
A custom io::Error payload's Debug impl is foreign code and may panic; Error::from and the write helper now format the ErrorKind only.
The derived length guards were compiled out on 64-bit, where lengths were assumed not to overflow; Size sums saturate there too now. A derived SerializeBytes with a length above isize::MAX panicked in Vec::with_capacity; it now returns InvalidVectorLength. Derived enum SerializeBytes gets the saturated-Size guard too.
…es mismatch In debug builds, serializing a TlsVecU*/SecretTlsVecU*/TlsSliceU* whose elements write a different number of bytes than their tls_serialized_len hit a debug_assert_eq! and panicked; release builds returned Err(EncodingError). The check right after the assert already handles the case.
clementblaudeau
force-pushed
the
pr/tls_codec-fixes
branch
from
December 1, 2026 16:04
81a93d9 to
7988196
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.