[PR #1017] Fix some IStreamStack and SharpCompressStream functions #1442

Open
opened 2026-01-29 22:20:35 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/adamhathcock/sharpcompress/pull/1017

State: closed
Merged: Yes


Buffer handling seems to have been completely broken.
I've fixed the handling in IStreamStack.StackSeek that basically duplicated the logic from SharpCompressStream.Seek (while not actually working correctly), fixed incorrect behavior of the IStreamStack.BufferPosition setter and fixed and off-by-one in SharpCompressStream.Seek.

I suspect there are more issues in StackSeek that may or may not even be relevant for how buffered IStreamStacks 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:

  • make some tests for this to validate behavior
**Original Pull Request:** https://github.com/adamhathcock/sharpcompress/pull/1017 **State:** closed **Merged:** Yes --- - resolves #960 Buffer handling seems to have been completely broken. I've fixed the handling in `IStreamStack.StackSeek` that basically duplicated the logic from `SharpCompressStream.Seek` (while not actually working correctly), fixed incorrect behavior of the `IStreamStack.BufferPosition` setter and fixed and off-by-one in `SharpCompressStream.Seek`. I suspect there are more issues in `StackSeek` that may or may not even be relevant for how buffered `IStreamStack`s 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: - [x] make some tests for this to validate behavior
claunia added the pull-request label 2026-01-29 22:20:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1442