mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 13:34:59 +00:00
AbstractReader.Skip() does not fully read bytes from non-local streams #214
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @heebaek on GitHub (Jul 14, 2017).
for (var i = 0; i < bytesToAdvance / skipBuffer.Length; i++)
{
rawStream.Read(skipBuffer, 0, skipBuffer.Length);
}
rawStream.Read(skipBuffer, 0, (int)(bytesToAdvance % skipBuffer.Length));
this code assume rawStream.Read always read until requested count.
but if you test with remote stream (from network like ftp), MoveToNextEntry() throw Unknown header exception. because skip function do not actually skip.
i fixed code like this, and it works fine for me.
please let me know if it is not a bug.
@adamhathcock commented on GitHub (Jul 14, 2017):
You're probably correct in that I have some bad skip code. I've noticed recently there are several different implementations of this kind of thing in the codebase. I need to consolidate this at the very least.
I have Skip/Transfer code in Utility.cs that probably should be used instead and does what you're referring to.
I likely won't get time for a while to fix this but pull requests are welcome :)
@adamhathcock commented on GitHub (Jul 15, 2017):
Made a PR to fix this issue