Commit 8ad087c4 authored by Him188's avatar Him188

Add fast-fail size check

parent 80078ab2
...@@ -25,9 +25,13 @@ class ExternalImage( ...@@ -25,9 +25,13 @@ class ExternalImage(
val md5: ByteArray, val md5: ByteArray,
imageFormat: String, imageFormat: String,
val input: Input, val input: Input,
val inputSize: Long, val inputSize: Long, // dont be greater than Int.MAX
val filename: String val filename: String
) { ) {
init {
check(inputSize in Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong()) { "file is too big" }
}
companion object { companion object {
operator fun invoke( operator fun invoke(
width: Int, width: Int,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment