diff --git a/cache/src/main/kotlin/org/openrs2/cache/Js5Compression.kt b/cache/src/main/kotlin/org/openrs2/cache/Js5Compression.kt index f2c2643e..b4d82cf5 100644 --- a/cache/src/main/kotlin/org/openrs2/cache/Js5Compression.kt +++ b/cache/src/main/kotlin/org/openrs2/cache/Js5Compression.kt @@ -187,8 +187,9 @@ public object Js5Compression { } if (type == Js5CompressionType.UNCOMPRESSED) { - if (input.readableBytes() < len) { - throw IOException("Data truncated") + val n = input.readableBytes() + if (n < len) { + throw IOException("Data truncated ($n bytes, expecting $len)") } /* @@ -213,8 +214,9 @@ public object Js5Compression { } val lenWithUncompressedLen = len + 4 - if (input.readableBytes() < lenWithUncompressedLen) { - throw IOException("Compressed data truncated") + val n = input.readableBytes() + if (n < lenWithUncompressedLen) { + throw IOException("Compressed data truncated ($n bytes, expecting $lenWithUncompressedLen)") } /*