Skip to content

Commit e525dfb

Browse files
Fix SubReadStream seek operations to have immediate observable effects
Co-authored-by: alinpahontu2912 <[email protected]>
1 parent d0aa6e4 commit e525dfb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCustomStreams.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ public override long Position
266266

267267
ArgumentOutOfRangeException.ThrowIfNegative(value);
268268

269-
_positionInSuperStream = _startInSuperStream + value;
269+
long newPositionInSuperStream = _startInSuperStream + value;
270+
_superStream.Seek(newPositionInSuperStream, SeekOrigin.Begin);
271+
_positionInSuperStream = newPositionInSuperStream;
270272
}
271273
}
272274

@@ -392,6 +394,7 @@ public override long Seek(long offset, SeekOrigin origin)
392394
throw new IOException(SR.IO_SeekBeforeBegin);
393395
}
394396

397+
_superStream.Seek(newPositionInSuperStream, SeekOrigin.Begin);
395398
_positionInSuperStream = newPositionInSuperStream;
396399

397400
return _positionInSuperStream - _startInSuperStream;

0 commit comments

Comments
 (0)