Skip to content

Commit 43df6ed

Browse files
devedseclaude
andcommitted
Fix SynchronizedSparseStream Position never advancing (regressed in 4b5b75d)
The synchronized wrapper kept its own Position auto-property and set content.Position = Position before each operation but never wrote the advanced position back afterward, so Position stayed frozen and reads/writes through the wrapper re-processed the same offset (e.g. ExFat ReadLongSparseLimited read the wrong data). Delegate Position to content.Position under the lock - correct for this single-shared- cursor synchronized wrapper and fixes every read/write path (sync and async) at once. Introduced by 4b5b75d ("Synchronized wrappers for disks and streams"). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 07e74d2 commit 43df6ed

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Library/DiscUtils.Streams/SparseStream.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,11 @@ private sealed class SynchronizedSparseStream(SparseStream content, Ownership ow
656656

657657
public override long Length => content.Length;
658658

659-
public override long Position { get; set; }
659+
public override long Position
660+
{
661+
get { lock (sync) { return content.Position; } }
662+
set { lock (sync) { content.Position = value; } }
663+
}
660664

661665
public override void Flush()
662666
{

0 commit comments

Comments
 (0)