prevent crash when editing mp4 with large moov box
This commit is contained in:
parent
94af48a97f
commit
5f71651baa
1 changed files with 1 additions and 0 deletions
|
@ -238,6 +238,7 @@ object Mp4ParserHelper {
|
|||
}
|
||||
|
||||
fun Box.toBytes(): ByteArray {
|
||||
if (size > BOX_SIZE_DANGER_THRESHOLD) throw Exception("box (type=$type size=$size) is too large")
|
||||
val stream = ByteArrayOutputStream(size.toInt())
|
||||
Channels.newChannel(stream).use { getBox(it) }
|
||||
return stream.toByteArray()
|
||||
|
|
Loading…
Reference in a new issue