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
Length of the field presented in the long form can be up to 2^1008-1 (126 bytes). After this length is read, JSch tries to allocate a byte array of such size without checking that such amount of bytes can be even read from the stream itself. As length is int it can't be bigger than 2^31 - 1, but that's still 2Gb of memory allocated that might easily lead to OutOfMemoryError.
KeyPairRSA.parse
method has several similar sections where the DER fields are parsed, e.g.:jsch/src/main/java/com/jcraft/jsch/KeyPairRSA.java
Lines 237 to 246 in 1021900
Length of the field presented in the long form can be up to 2^1008-1 (126 bytes). After this length is read, JSch tries to allocate a byte array of such size without checking that such amount of bytes can be even read from the stream itself. As
length
isint
it can't be bigger than 2^31 - 1, but that's still 2Gb of memory allocated that might easily lead toOutOfMemoryError
.Payload to reproduce the problem:
The text was updated successfully, but these errors were encountered: