#vulnerable code 
                                Optional<Chunk>
            decrypt(BoundedInputStream bis, byte[] chunkEncryptionKey, byte[] checksum, int index) throws IOException {
        unwrapKey(chunkEncryptionKey, index)
                .map(u -> {
                    logger.debug("-- decrypt() - key unwrapped: 0x{} chunk: 0x{}",
                            Hex.toHexString(u), Hex.toHexString(checksum));
                    return cipherInputStreams.apply(u, bis);
                })
                .<IORunnable>map(u -> () -> store(u, checksum))
                .orElse(() -> {
                    logger.warn("-- decrypt() - key unwrap failed chunk: 0x{}", Hex.toHexString(checksum));
                })
                .run();
        return store.chunk(checksum);
    } 
                            #location 13 
                            #vulnerability type INTERFACE_NOT_THREAD_SAFE
#fixed code
                                Optional<Chunk> chunk(InputStream inputStream, ChunkServer.ChunkInfo chunkInfo, int index) throws IOException {
        logger.trace("<< chunk() - chunkInfo: {} index: {}", chunkInfo, index);

        BoundedInputStream bis = new BoundedInputStream(inputStream, chunkInfo.getChunkLength());
        bis.setPropagateClose(false);
        Optional<Chunk> chunk = chunk(bis, chunkInfo, index);
        consume(bis);

        logger.trace(">> chunk() - chunk: {}", chunk);
        return chunk;
    }