mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-10 20:20:08 +08:00
Add fast-fail size check
This commit is contained in:
parent
80078ab25e
commit
8ad087c406
@ -25,9 +25,13 @@ class ExternalImage(
|
||||
val md5: ByteArray,
|
||||
imageFormat: String,
|
||||
val input: Input,
|
||||
val inputSize: Long,
|
||||
val inputSize: Long, // dont be greater than Int.MAX
|
||||
val filename: String
|
||||
) {
|
||||
init {
|
||||
check(inputSize in Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong()) { "file is too big" }
|
||||
}
|
||||
|
||||
companion object {
|
||||
operator fun invoke(
|
||||
width: Int,
|
||||
|
Loading…
Reference in New Issue
Block a user