v2.2.29 - #249
Merged
Merged
v2.2.29#249
Conversation
storePacket() and storeFileBytes() used a strict '>' when checking whether a write fits in the file buffer's available space. This let a write of exactly fileBufferSpaceAvailable() bytes succeed, which can bring fileBufferHead back around to equal fileBufferTail. Since head == tail is used elsewhere to mean 'buffer empty', the just written bytes become invisible to fileBufferSpaceUsed() and are silently lost from extractFileBufferData(). Changing both guards to '>=' reserves fileBufferSize - 1 as the buffer's usable capacity (the standard fix for ring buffers that use head == tail to mean empty), so a write can never exactly fill the buffer and recreate the ambiguity.
Fix file-buffer exact-fit guard (off-by-one) to prevent silent data loss
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.