-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SftpInputStreamAsync#read(byte[], int, int) fails on calls with len = 0 #398
Comments
mkeckmkeck
added a commit
to scireum/sirius-biz
that referenced
this issue
Jul 19, 2023
- 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
tomaswolf
added a commit
to tomaswolf/mina-sshd
that referenced
this issue
Jul 20, 2023
Only return EOF once the EOF indicator is set *and* there is no more buffered data. Bug: apache#398
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: