hierynomus / hierynomus/sshj

Error during opening file: java.lang.ArrayIndexOutOfBoundsException: arraycopy: destination index -4 out of bounds for byte[256]

Open
#532 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

During opening the file in this way :

`RemoteFile remoteFile = sftpClient.open(path)`

I've faced with following error with stacktrace:

> java.lang.ArrayIndexOutOfBoundsException: arraycopy: destination index -4 out of bounds for byte[256]
at net.schmizz.sshj.common.Buffer.putRawBytes(Buffer.java:271)
at net.schmizz.sshj.connection.channel.ChannelOutputStream$DataBuffer.write(ChannelOutputStream.java:64)
at net.schmizz.sshj.connection.channel.ChannelOutputStream.write(ChannelOutputStream.java:141)
at net.schmizz.sshj.connection.channel.ChannelOutputStream.write(ChannelOutputStream.java:131)
at net.schmizz.sshj.sftp.SFTPEngine.transmit(SFTPEngine.java:292)
at net.schmizz.sshj.sftp.SFTPEngine.request(SFTPEngine.java:130)
at net.schmizz.sshj.sftp.SFTPEngine.doRequest(SFTPEngine.java:136)
at net.schmizz.sshj.sftp.SFTPEngine.open(SFTPEngine.java:141)
at net.schmizz.sshj.sftp.SFTPClient.open(SFTPClient.java:68)
at net.schmizz.sshj.sftp.SFTPClient.open(SFTPClient.java:73)
at net.schmizz.sshj.sftp.SFTPClient.open(SFTPClient.java:78)
at com.echovox.paidle.common.util.SftpUtil.getFileDataListFromZip(SftpUtil.java:86)
at com.echovox.paidle.common.util.SftpUtil.lambda$getFileDataWithRetry$1(SftpUtil.java:139)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

I found 3 implementation of `open` method:

`public RemoteFile open(String filename)`
`public RemoteFile open(String filename, Set mode)`
`public RemoteFile open(String filename, Set mode, FileAttributes attrs)`

Is it possible to use somehow `Set mode` and/or `FileAttributes attrs` to avoid this issue?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.