[PR #1017] [MERGED] Fix some IStreamStack and SharpCompressStream functions #1438

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

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/1017
Author: @Morilli
Created: 11/14/2025
Status: Merged
Merged: 11/14/2025
Merged by: @adamhathcock

Base: masterHead: fix-streamstack


📝 Commits (4)

  • 97f58b4 Add test for StackSeek behavior
  • 9a876ab fix IStreamStack.StackSeek with buffering streams
  • 7835219 fix SharpCompressStream BufferSize setter and Seek as well
  • e3a25ec make formatting worse with csharpier

📊 Changes

3 files changed (+28 additions, -11 deletions)

View changed files

📝 src/SharpCompress/IO/IStreamStack.cs (+8 -9)
📝 src/SharpCompress/IO/SharpCompressStream.cs (+2 -2)
📝 tests/SharpCompress.Test/Streams/RewindableStreamTest.cs (+18 -0)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/1017 **Author:** [@Morilli](https://github.com/Morilli) **Created:** 11/14/2025 **Status:** ✅ Merged **Merged:** 11/14/2025 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `fix-streamstack` --- ### 📝 Commits (4) - [`97f58b4`](https://github.com/adamhathcock/sharpcompress/commit/97f58b412eb919738097ccdf87595b9f3679bdd9) Add test for StackSeek behavior - [`9a876ab`](https://github.com/adamhathcock/sharpcompress/commit/9a876abd3103cd84e9f5ea259bb8a2fc924fd43f) fix IStreamStack.StackSeek with buffering streams - [`7835219`](https://github.com/adamhathcock/sharpcompress/commit/783521928df435ebcd3c9a6d77be7960e0fdd0ea) fix SharpCompressStream BufferSize setter and Seek as well - [`e3a25ec`](https://github.com/adamhathcock/sharpcompress/commit/e3a25ecdc0867e466cb849e164b79c3c889c4a64) make formatting worse with csharpier ### 📊 Changes **3 files changed** (+28 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/IO/IStreamStack.cs` (+8 -9) 📝 `src/SharpCompress/IO/SharpCompressStream.cs` (+2 -2) 📝 `tests/SharpCompress.Test/Streams/RewindableStreamTest.cs` (+18 -0) </details> ### 📄 Description - 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1438