mirror of
https://github.com/derrod/legendary.git
synced 2025-01-03 04:45:28 +00:00
[models] Raise exception when chunk data too large
This commit is contained in:
parent
2c3bfdfd3a
commit
17ea65d2da
|
@ -51,6 +51,8 @@ class Chunk:
|
||||||
|
|
||||||
@data.setter
|
@data.setter
|
||||||
def data(self, value: bytes):
|
def data(self, value: bytes):
|
||||||
|
if len(value) > 1024*1024:
|
||||||
|
raise ValueError('Provided data is too large (> 1 MiB)!')
|
||||||
# data is now uncompressed
|
# data is now uncompressed
|
||||||
if self.compressed:
|
if self.compressed:
|
||||||
self.stored_as ^= 0x1
|
self.stored_as ^= 0x1
|
||||||
|
|
Loading…
Reference in a new issue