diff --git a/gradle.properties b/gradle.properties index 4f78a11..ea97363 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official specifyKotlinAsDependency=false projectGroup=ru.dbotthepony.kommons -projectVersion=2.1.3 +projectVersion=2.1.5 guavaDepVersion=33.0.0 gsonDepVersion=2.8.9 diff --git a/src/main/kotlin/ru/dbotthepony/kommons/io/InputStreamUtils.kt b/src/main/kotlin/ru/dbotthepony/kommons/io/InputStreamUtils.kt index 7ec55a7..c232d21 100644 --- a/src/main/kotlin/ru/dbotthepony/kommons/io/InputStreamUtils.kt +++ b/src/main/kotlin/ru/dbotthepony/kommons/io/InputStreamUtils.kt @@ -85,6 +85,9 @@ private fun readVarLongInfo(supplier: IntSupplier): VarLongReadResult { var read = supplier.asInt var i = 1 + if (read == -1) + throw EOFException() + while (true) { result = (result shl 7) or (read.toLong() and 0x7F) @@ -92,6 +95,10 @@ private fun readVarLongInfo(supplier: IntSupplier): VarLongReadResult { break read = supplier.asInt + + if (read == -1) + throw EOFException("Reached end of stream before finished reading variable length integer (read totally $i bytes)") + i++ }