Skip to content

Commit 6f462dd

Browse files
committed
Merge branch 'release/2.6.5'
2 parents ec3871d + c494ac6 commit 6f462dd

File tree

5 files changed

+25
-14
lines changed

5 files changed

+25
-14
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.cryptomator</groupId>
44
<artifactId>cryptofs</artifactId>
5-
<version>2.6.4</version>
5+
<version>2.6.5</version>
66
<name>Cryptomator Crypto Filesystem</name>
77
<description>This library provides the Java filesystem provider used by Cryptomator.</description>
88
<url>https://github.com/cryptomator/cryptofs</url>
@@ -21,7 +21,7 @@
2121
<cryptolib.version>2.1.2</cryptolib.version>
2222
<jwt.version>4.3.0</jwt.version>
2323
<dagger.version>2.44.2</dagger.version>
24-
<guava.version>31.1-jre</guava.version>
24+
<guava.version>32.0.0-jre</guava.version>
2525
<caffeine.version>3.1.4</caffeine.version>
2626
<slf4j.version>2.0.3</slf4j.version>
2727

src/main/java/org/cryptomator/cryptofs/fh/ChunkCache.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ public Chunk putChunk(long chunkIndex, ByteBuffer chunkData) throws IllegalArgum
8686
if (chunk == null) {
8787
chunk = new Chunk(chunkData, true, () -> releaseChunk(chunkIndex));
8888
} else {
89-
var dst = chunk.data().duplicate().clear();
89+
var dst = chunk.data().clear();
9090
Preconditions.checkArgument(chunkData.remaining() == dst.remaining());
91-
dst.put(chunkData);
91+
dst.put(chunkData) //
92+
.flip();
9293
chunk.dirty().set(true);
9394
}
9495
chunk.currentAccesses().incrementAndGet();

src/test/java/org/cryptomator/cryptofs/CryptoFileChannelWriteReadIntegrationTest.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import java.util.concurrent.Executors;
5454
import java.util.concurrent.TimeUnit;
5555
import java.util.concurrent.atomic.AtomicBoolean;
56-
import java.util.concurrent.atomic.AtomicInteger;
5756
import java.util.stream.IntStream;
5857
import java.util.stream.Stream;
5958

@@ -175,6 +174,25 @@ public void afterEach() throws IOException {
175174
Files.deleteIfExists(file);
176175
}
177176

177+
//https://github.com/cryptomator/cryptofs/issues/173
178+
@Test
179+
@DisplayName("First incomplete, then completely filled chunks are stored completely")
180+
public void testFullChunksAreSavedCompletely() throws IOException {
181+
int halfAChunk = 16_384; //half of cleartext chunk size
182+
try (var writer = FileChannel.open(file, CREATE, WRITE)) {
183+
writer.write(ByteBuffer.allocate(3 * halfAChunk), 0); //fill chunk 0, half fill chunk 1
184+
writer.write(ByteBuffer.allocate(5 * halfAChunk), 0); //fill chunks 0 and 1, half fill chunk 2
185+
}
186+
187+
try (var reader = FileChannel.open(file, CREATE, READ)) {
188+
Assertions.assertAll(() -> reader.read(ByteBuffer.allocate(2 * halfAChunk), 0), //read chunk 0
189+
() -> reader.read(ByteBuffer.allocate(2 * halfAChunk), 2 * halfAChunk), //read chunk 1
190+
() -> reader.read(ByteBuffer.allocate(halfAChunk), 4 * halfAChunk) //read chunk 2
191+
);
192+
}
193+
194+
}
195+
178196
@Test
179197
public void testLockEmptyChannel() throws IOException {
180198
try (FileChannel ch = FileChannel.open(file, CREATE, WRITE)) {

src/test/java/org/cryptomator/cryptofs/CryptoFileSystemsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public class CryptoFileSystemsTest {
7070
@BeforeEach
7171
public void setup() throws IOException, MasterkeyLoadingFailedException {
7272
vaultConficClass = Mockito.mockStatic(VaultConfig.class);
73-
filesClass = Mockito.mockStatic(Files.class);
7473
cryptorProviderClass = Mockito.mockStatic(CryptorProvider.class);
7574
backupHelperClass = Mockito.mockStatic(BackupHelper.class);
75+
filesClass = Mockito.mockStatic(Files.class);
7676

7777
when(pathToVault.normalize()).thenReturn(normalizedPathToVault);
7878
when(normalizedPathToVault.resolve("vault.cryptomator")).thenReturn(configFilePath);

suppression.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,4 @@
99
<cpe>cpe:/a:cryptomator:cryptomator</cpe>
1010
<cve>CVE-2022-25366</cve>
1111
</suppress>
12-
<suppress>
13-
<notes><![CDATA[
14-
Suppress false positive, because com.google.common.io.Files.createTempDir() is not used
15-
]]></notes>
16-
<packageUrl regex="true">^pkg:maven/com\.google\.guava/guava@.*$</packageUrl>
17-
<vulnerabilityName>CVE-2020-8908</vulnerabilityName>
18-
<cve>CVE-2020-8908</cve>
19-
</suppress>
2012
</suppressions>

0 commit comments

Comments
 (0)