You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing len = 0 on a second read call, after eofIndicator has already be set to true, the read method returns -1. This can lead to an incomplete read when using e.g. java.io.InputStream#readAllBytes or java.io.InputStream#readNBytes(int).
A possible solution would be an early return of 0 in case of len = 0
Actual behavior
First reading offset 0, len 8192,
then offset 8192, len 0
then offset 8192, len 8192
Return in sum at most 8192 bytes (if available)
Expected behavior
First reading offset 0, len 8192,
then offset 8192, len 0
then offset 8192, len 8192
Return in sum more 8192 bytes (if available)
Relevant log output
No response
Other information
No response
The text was updated successfully, but these errors were encountered:
- org.apache.sshd.sftp.client.impl.SftpInputStreamAsync#read(byte[], int, int) sometimes
behaves incorrectly when reading a length of 0 by returning -1 whilst the actual buffer does
not hit EOF yet
- see apache/mina-sshd#398 for details
- the BufferedInputStream is a workaround, as it early returns 0 when requesting length 0
Version
2.9.2
Bug description
When passing len = 0 on a second read call, after eofIndicator has already be set to true, the read method returns -1. This can lead to an incomplete read when using e.g. java.io.InputStream#readAllBytes or java.io.InputStream#readNBytes(int).
A possible solution would be an early return of 0 in case of len = 0
Actual behavior
First reading offset 0, len 8192,
then offset 8192, len 0
then offset 8192, len 8192
Return in sum at most 8192 bytes (if available)
Expected behavior
First reading offset 0, len 8192,
then offset 8192, len 0
then offset 8192, len 8192
Return in sum more 8192 bytes (if available)
Relevant log output
No response
Other information
No response
The text was updated successfully, but these errors were encountered: