Add expected/actual lengths to Js5Compression error messages

Signed-off-by: Graham <gpe@openrs2.org>
Graham 1 year 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 (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)")
}
/*

Loading…
Cancel
Save