Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/java/org/apache/cassandra/security/EncryptionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ public int read(ByteBuffer dst) throws IOException
{
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;
}

Expand Down
7 changes: 6 additions & 1 deletion src/java/org/apache/cassandra/security/SSLFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ private static void checkCachedContextsForReload(boolean forceReload)
*/
public static void clearSslContextCache()
{
cachedSslContexts.values().forEach(ReferenceCountUtil::release);
cachedSslContexts.clear();
}

Expand All @@ -244,7 +245,11 @@ private static void clearSslContextCache(EncryptionOptions options, List<CacheKe
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);
}
});
Expand Down