SourceStream Position counting bug fix

This commit is contained in:
Lars Vahlenberg
2022-07-30 16:28:43 +02:00
parent 3009e6dcfd
commit 0ae75634b1
2 changed files with 10 additions and 4 deletions

View File

@@ -143,9 +143,17 @@ namespace SharpCompress.IO
if (!IsVolumes && count != 0 && Current.Position == Current.Length)
{
_prevSize += Current.Length;
if (!SetStream(_stream + 1)) //will load next file if present
var length = Current.Length;
// Load next file if present
if (!SetStream(_stream + 1))
{
break;
}
// Current stream switched
// Add length of previous stream
_prevSize += length;
Current.Seek(0, SeekOrigin.Begin);
}
}

View File

@@ -170,10 +170,8 @@ namespace SharpCompress
byte[] buffer = GetTransferByteArray();
try
{
var pos = source.Position;
int count = 0;
var len = source.Read(buffer, 0, buffer.Length);
source.Position = pos + len;
do
{