Fix slice bounds check in SlicedByteArray and release version 0.3.3.

This commit is contained in:
2025-06-16 19:46:04 +02:00
parent ad1fdf366b
commit ab6694ca6a
2 changed files with 2 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ plugins {
}
group = "nl.astraeus"
version = "0.3.3-SNAPSHOT"
version = "0.3.3"
repositories {
mavenCentral()

View File

@@ -188,7 +188,7 @@ class SlicedByteArray(
fun slice(offset: Int, length: Int): SlicedByteArray {
check(offset >= 0) { "Offset must be non-negative" }
check(length >= 0) { "Length must be non-negative" }
check(offset + length <= this.length) { "Offset + length exceeds array bounds (offset: $offset, length: $length, array length: ${this.length})" }
check(offset + length <= this.data.size) { "Offset + length exceeds array bounds (offset: $offset, length: $length, array length: ${this.data.size})" }
return SlicedByteArray(data, this.offset + offset, length)
}