Fix some IStreamStack and SharpCompressStream functions#1017
Merged
adamhathcock merged 4 commits intoadamhathcock:masterfrom Nov 14, 2025
Merged
Fix some IStreamStack and SharpCompressStream functions#1017adamhathcock merged 4 commits intoadamhathcock:masterfrom
adamhathcock merged 4 commits intoadamhathcock:masterfrom
Conversation
the BufferSize setter was completely broken and trashed the `_internalPosition` value on set, for `Seek` this is just an off-by-one fix allowing seeking to immediately past the last byte in the buffer
5f13b8d to
e3a25ec
Compare
adamhathcock
approved these changes
Nov 14, 2025
Owner
adamhathcock
left a comment
There was a problem hiding this comment.
Thanks, I'll take a look at this. Seek and setting BufferPosition should be the same thing?
Contributor
Author
For a buffered stream, it is the same if the seek would only seek to somewhere inside of the currently buffered region. Unfortunately some buffered streams aren't seekable so we can't unconditionally call seek without trying to set the buffer position beforehand. This seems to be mainly required for archive detection logic as that uses a buffered, non-seekable stream for rewind logic where we need to be able to rewind the buffer position while not having access to the |
This was referenced Dec 1, 2025
This was referenced Dec 8, 2025
This was referenced Dec 15, 2025
This was referenced Dec 22, 2025
This was referenced Jan 5, 2026
This was referenced Jan 12, 2026
This was referenced Jan 19, 2026
This was referenced Jan 26, 2026
This was referenced Feb 13, 2026
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.
Buffer handling seems to have been completely broken.
I've fixed the handling in
IStreamStack.StackSeekthat basically duplicated the logic fromSharpCompressStream.Seek(while not actually working correctly), fixed incorrect behavior of theIStreamStack.BufferPositionsetter and fixed and off-by-one inSharpCompressStream.Seek.I suspect there are more issues in
StackSeekthat may or may not even be relevant for how bufferedIStreamStacks are even used. It's hard to tell because the method documentation does not seem to fully match the implementation.This allows reverting #964 now that the underlying issue has been fixed.
TODO: