This commit is contained in:
Gagan Dhakrey 2026-07-29 13:36:12 +08:00 committed by GitHub
commit 2a814b076d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -257,7 +257,8 @@ public class EncryptionUtils
{
int readLength = dst.remaining();
// we should only be performing encrypt/decrypt operations with on-heap buffers, so calling BB.array() should be legit here
fileDataInput.readFully(dst.array(), dst.position(), readLength);
fileDataInput.readFully(dst.array(), dst.arrayOffset() + dst.position(), readLength);
dst.position(dst.position() + readLength);
return readLength;
}

View File

@ -233,6 +233,7 @@ public final class SSLFactory
*/
public static void clearSslContextCache()
{
cachedSslContexts.values().forEach(ReferenceCountUtil::release);
cachedSslContexts.clear();
}
@ -244,7 +245,11 @@ public final class SSLFactory
cachedSslContexts.forEachKey(1, cacheKey -> {
if (Objects.equals(options, cacheKey.encryptionOptions))
{
cachedSslContexts.remove(cacheKey);
SslContext ctx = cachedSslContexts.remove(cacheKey);
if (ctx != null)
{
ReferenceCountUtil.release(ctx);
}
keysToCheck.remove(cacheKey);
}
});