Repository navigation
Conversation
ArniDagur
marked this pull request as draft
December 3, 2026 04:29
ArniDagur
force-pushed
the
fix-drained-partial-read-truncation
branch
from
December 3, 2026 04:32
82a1681 to
afe5049
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #81 +/- ##
==========================================
+ Coverage 87.69% 88.34% +0.64%
==========================================
Files 6 6
Lines 943 1064 +121
==========================================
+ Hits 827 940 +113
- Misses 116 124 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
In `KtlsStream::poll_read`, `let drained = &drained[*drain_index..];` shadowed the underlying `Vec<u8>` with the remaining unread slice. The subsequent `if *drain_index >= drained.len()` check therefore compared the cumulative read index against the remaining length instead of the full buffer length, clearing `this.drained` and silently dropping the remaining bytes once reads passed the midpoint.
ArniDagur
force-pushed
the
fix-drained-partial-read-truncation
branch
from
December 3, 2026 16:40
afe5049 to
ce2a8da
Compare
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.
In
KtlsStream::poll_read,let drained = &drained[*drain_index..];shadowed the underlyingVec<u8>with the remaining unread slice:As a result, once
*drain_indexreached half of the drained buffer across multiple partial reads (e.g., reading a 10-byte drained buffer in 3-byte chunks or 1 byte at a time),*drain_index >= remaining.len()evaluated totrue, clearingthis.drainedand silently dropping the remaining unread bytes.Renames the slice to
remainingso*drain_index >= drained.len()compares against the fullVeclength, and adds a unit test covering partial reads across multiple chunk sizes.