Skip to content

Commit d41ceca

Browse files
committed
Fixes #48
1 parent 77438c6 commit d41ceca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Library/DiscUtils.Streams/SubStream.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,16 @@ public override IEnumerable<StreamExtent> Extents
9191
return _first + virtualPosition;
9292
}
9393

94-
public override long Length => _length;
94+
/// <summary>
95+
/// Current length of the stream. This may be less than the maximum length
96+
/// if the underlying stream is shorter than the defined substream.
97+
/// </summary>
98+
public override long Length => Math.Min(_length, _parent.Length - _first);
99+
100+
/// <summary>
101+
/// Gets the maximum length allowed for the current stream.
102+
/// </summary>
103+
public long MaximumLength => _length;
95104

96105
public override long Position { get; set; }
97106

0 commit comments

Comments
 (0)