Add expected/actual lengths to Js5Compression error messages

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 9 months ago
parent cc3aa0aa60
commit 68a6d7c76c
  1. 10
      cache/src/main/kotlin/org/openrs2/cache/Js5Compression.kt

@ -187,8 +187,9 @@ public object Js5Compression {
} }
if (type == Js5CompressionType.UNCOMPRESSED) { if (type == Js5CompressionType.UNCOMPRESSED) {
if (input.readableBytes() < len) { val n = input.readableBytes()
throw IOException("Data truncated") if (n < len) {
throw IOException("Data truncated ($n bytes, expecting $len)")
} }
/* /*
@ -213,8 +214,9 @@ public object Js5Compression {
} }
val lenWithUncompressedLen = len + 4 val lenWithUncompressedLen = len + 4
if (input.readableBytes() < lenWithUncompressedLen) { val n = input.readableBytes()
throw IOException("Compressed data truncated") if (n < lenWithUncompressedLen) {
throw IOException("Compressed data truncated ($n bytes, expecting $lenWithUncompressedLen)")
} }
/* /*

Loading…
Cancel
Save