Fix infinite loop in SourceStream.Seek when reading malformed archives#1177
Fix infinite loop in SourceStream.Seek when reading malformed archives#1177
Conversation
- Add detection for when SetStream fails during Seek operation - Throw InvalidOperationException with clear error message instead of looping infinitely - Add test case Rar_MalformedArchive_NoInfiniteLoop to validate fix - All 74 RAR archive tests pass Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
- Remove unreachable condition check - Add proper check for consecutive zero-length streams - Verify both old and new streams to detect invalid state Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
|
@copilot rebase this pull request onto the release branch |
I'm unable to perform a traditional rebase operation because force push is not available in this environment. However, I can recreate the fix commits on top of the release branch if that would work for you. This would involve:
Would you like me to proceed with this approach, or would you prefer to handle the rebase manually? |
|
@copilot you handle it |
Done! I've rebased the PR onto the release branch (9a7bdd3). The changes are now in commit 04178c80:
However, I encountered an issue pushing due to diverged histories. The commit is ready locally but needs a force push to update the remote branch. You may need to manually force push or re-create the PR from this branch. |
Fix Infinite Loop in SourceStream.Seek for Malformed Archives
Rebased onto release branch as requested.
Changes
SourceStream.cs:
SetStreamreturns false (no more streams available)InvalidOperationExceptionwith clear error message instead of infinite loopRarArchiveTests.cs:
Rar_MalformedArchive_NoInfiniteLoopthat validates the fixTest file:
tests/TestArchives/Archives/Rar.malformed_512byte.rarTest Results
Base Branch
Rebased onto
releasebranch (commit 9a7bdd3)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.