Repository navigation
LZ4 decompession failed #353
Copy link
Copy link
Open
Labels
invalidThis doesn't seem rightThis doesn't seem right
Description
Code
import os
import UnityPy
UnityPy.config.FALLBACK_UNITY_VERSION = '2022.3.52f1'
env = UnityPy.load('avgbg_assets_bg0001_q_15caadfac7a047db4ea676ea62806d56.bundle')
for obj in env.objects:
print(obj.type.name)
print('End')Error
C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\files\BundleFile.py:526: UnityVersionFallbackWarning: No valid Unity version found, defaulting to UnityPy.config.FALLBACK_UNITY_VERSION (2022.3.52f1)
version_str = config.get_fallback_version()
Traceback (most recent call last):
File "E:\code\unity_unpack\test.py", line 7, in <module>
env = UnityPy.load('avgbg_assets_bg0001_q_15caadfac7a047db4ea676ea62806d56.bundle')
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\environment.py", line 63, in __init__
self.load_file(arg)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\environment.py", line 152, in load_file
f = parse_file(reader, self, name=stream_name, typ=typ, is_dependency=is_dependency)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\helpers\ImportHelper.py", line 141, in parse_file
f = files.BundleFile(reader, parent, name=name, is_dependency=is_dependency)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\files\BundleFile.py", line 46, in __init__
m_DirectoryInfo, blocksReader = self.read_fs(reader)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\files\BundleFile.py", line 174, in read_fs
b"".join(
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\files\BundleFile.py", line 175, in <genexpr>
self.decompress_data(
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\files\BundleFile.py", line 511, in decompress_data
CompressionHelper.DECOMPRESSION_MAP[comp_flag](compressed_data, uncompressed_size),
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\UnityPy\helpers\CompressionHelper.py", line 94, in decompress_lz4
return lz4.block.decompress(data, uncompressed_size)
_block.LZ4BlockError: Decompression failed: corrupt input or insufficient space in destination buffer. Error code: 33627
Bug
Lib should load file, but raises an exception
To Reproduce
- a copy of the file that causes the problem: https://drive.google.com/file/d/1RGDOKK8aX119fpFJ8Jhz2JpnWTkrWDDD/view?usp=sharing
- following data:
- Python version: 3.10.11
- UnityPy version: 1.24.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
invalidThis doesn't seem rightThis doesn't seem right
Activity
isHarryh commentedon Dec 17, 2025
Maybe the bundle file is not complete. It seems like some bytes are missing in the end of file.
The decompression error occurred at the last LZ4HC block of the file. The following image shows why and where the decompression error occurred.
Left: LZ4 block decompression code implemented in Python; Right: Your file.
Reads more about LZ4 block: https://github.com/lz4/lz4/blob/c609c16aed95ed339e142535b1b270e7b9e24ac1/doc/lz4_Block_format.md#lz4-block-format-description