-
-
Notifications
You must be signed in to change notification settings - Fork 963
Closed
Labels
Description
When SftpFileStream.Seek()
is called with the origin
parameter set to SeekOrigin.End
and a negative offset, the resulting position is greater than the size of the stream. This is because the negative offset is subtracted from the total size, instead of added.
newPosn = attributes.Size - offset; |
newPosn = attributes.Size - offset; |
size offset
1000 - (-42) = 1042
1000 + (-42) = 958
Failed test using SftpFileStream.Seek()
:
FluentAssertions.Execution.AssertionFailedException
HResult=0x80131500
Message=Expected stream.Seek(-5, SeekOrigin.End) to be 22L, but found 32L.
Furthermore, the tests for SftpFileStream
only cover cases with the origin
set to SeekOrigin.Begin
, and not SeekOrigin.Current
or SeekOrigin.End
.