Repository navigation
Fix some IStreamStack and SharpCompressStream functions - #1017
Merged
Merged
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
Morilli
force-pushed
the
fix-streamstack
branch
from
November 14, 2025 02:54
5f13b8d to
e3a25ec
Compare
adamhathcock
approved these changes
Nov 14, 2025
adamhathcock
left a comment
Owner
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 Aug 12, 2026
This was referenced Aug 29, 2026
This was referenced Sep 14, 2026
This was referenced Sep 21, 2026
This was referenced Oct 11, 2026
This was referenced Oct 25, 2026
This was referenced Nov 2, 2026
This was referenced Nov 9, 2026
This was referenced Nov 21, 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: