Repository navigation
inout: fix Miri Stacked Borrows violation in PaddedInOutBuf - #1556
Merged
Merged
Conversation
Member
|
Thank you! I tweaked the code a bit to make it more straightforward. I guess we also should improve test coverage for |
inoutPaddedInOutBuf
Merged
newpavlov
added a commit
that referenced
this pull request
Oct 16, 2026
…ed_blocks` (#1560) `InOutBufReserved` only guarantees that the output buffer is at least as large as the input buffer. During the refactoring in #1556, the check that ensured the output buffer had enough space for the tail block was accidentally removed. Lack of the check allows to break the invariant important for the unsafe code in `PaddedInOutBuf` methods.
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.
While setting up Miri for CI on a work project, I noticed that the tests which used padded AES encryption were failing due to a problem Miri detected in
PaddedInOutBuf::into_out. Sincetail_blockcontains a mutable borrow ofout_ptr, creating a slice fromout_ptrwhiletail_blockis active is forbidden by Stacked Borrows.The test added here passes with tree borrows on current
master, but given that stacked borrows is stricter and less experimental, I'd prefer not to have to enable tree borrows, and so this change is required.