diff --git a/cache/src/main/kotlin/org/openrs2/cache/DiskStore.kt b/cache/src/main/kotlin/org/openrs2/cache/DiskStore.kt index a2f0e83a..e1ad1dfe 100644 --- a/cache/src/main/kotlin/org/openrs2/cache/DiskStore.kt +++ b/cache/src/main/kotlin/org/openrs2/cache/DiskStore.kt @@ -196,10 +196,6 @@ public class DiskStore private constructor( num++ } while (buf.isWritable) - if (block != 0) { - throw StoreCorruptException("Group longer than expected") - } - return buf.retain() } } diff --git a/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt b/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt index 8a3bee7e..b50e4a93 100644 --- a/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt +++ b/cache/src/test/kotlin/org/openrs2/cache/DiskStoreTest.kt @@ -495,12 +495,6 @@ class DiskStoreTest { @Test fun testReadCorrupt() { - readTest("corrupt-eof-late") { store -> - assertFailsWith { - store.read(255, 1).release() - } - } - readTest("corrupt-first-eof-early") { store -> assertFailsWith { store.read(255, 1).release() @@ -562,6 +556,17 @@ class DiskStoreTest { } } + @Test + fun testReadCorruptEofLate() { + readTest("corrupt-eof-late") { store -> + copiedBuffer("OpenRS2".repeat(1000)).use { expected -> + store.read(255, 1).use { actual -> + assertEquals(expected, actual) + } + } + } + } + @Test fun testOverwriteCorrupt() { overwriteTest("corrupt-eof-late", "corrupt-eof-late-overwritten") { store ->