diff --git a/global.json b/global.json index f5d6141c..8a7554cf 100644 --- a/global.json +++ b/global.json @@ -3,4 +3,4 @@ "version": "10.0.301", "rollForward": "disable" } -} +} \ No newline at end of file diff --git a/src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack50_async.cs b/src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack50_async.cs index cabce8cf..fbb2d607 100644 --- a/src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack50_async.cs +++ b/src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack50_async.cs @@ -394,28 +394,34 @@ internal partial class Unpack { await UnpIO_UnpWriteAsync(OutMem, 0, BlockLength, cancellationToken) .ConfigureAwait(false); - WrittenFileSize += BlockLength; } + UnpSomeRead = true; + WrittenFileSize += BlockLength; WrittenBorder = BlockEnd; WriteSizeLeft = (UnpPtr - WrittenBorder) & MaxWinMask; } } else { - NotAllFiltersProcessed = true; + // Current filter intersects the window write border, so we adjust + // the window border to process this filter next time, not now. + WrPtr = WrittenBorder; + + // Since Filter start position can only increase, we quit processing + // all following filters for this data block and reset 'NextWindow' + // flag for them. for (var J = I; J < Filters.Count; J++) { var fltj = Filters[J]; - if ( - fltj.Type != FILTER_NONE - && fltj.NextWindow == false - && ((fltj.BlockStart - WrPtr) & MaxWinMask) < FullWriteSize - ) + if (fltj.Type != FILTER_NONE) { - fltj.NextWindow = true; + fltj.NextWindow = false; } } + + // Do not write data left after current filter now. + NotAllFiltersProcessed = true; break; } }