Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_block.LZ4BlockError: Decompression failed (Error code: 30236) #106

Open
davispuh opened this issue Oct 31, 2021 · 4 comments
Open

_block.LZ4BlockError: Decompression failed (Error code: 30236) #106

davispuh opened this issue Oct 31, 2021 · 4 comments

Comments

@davispuh
Copy link

Hi,

I'm trying to extract images from UnityFS bundles but unfortunately it fails

Header is

00000000  55 6e 69 74 79 46 53 00  00 00 00 07 35 2e 78 2e  |UnityFS.....5.x.|
00000010  78 00 32 30 32 31 2e 32  2e 30 62 39 00 00 00 00  |x.2021.2.0b9....|
00000020  00 03 69 cb dd 00 00 12  5f 00 00 12 5f 00 00 00  |..i....._..._...|
00000030  c0 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
$ unityextract --images -o /tmp/ __data
Traceback (most recent call last):
  File "/usr/bin/unityextract", line 159, in <module>
    main()
  File "/usr/bin/unityextract", line 155, in main
    exit(app.run())
  File "/usr/bin/unityextract", line 54, in run
    bundle = unitypack.load(f)
  File "/usr/lib/python3.9/site-packages/unitypack/__init__.py", line 12, in load
    return env.load(file)
  File "/usr/lib/python3.9/site-packages/unitypack/environment.py", line 28, in load
    ret.load(file)
  File "/usr/lib/python3.9/site-packages/unitypack/assetbundle.py", line 49, in load
    self.load_unityfs(buf)
  File "/usr/lib/python3.9/site-packages/unitypack/assetbundle.py", line 128, in load_unityfs
    storage = ArchiveBlockStorage(blocks, buf)
  File "/usr/lib/python3.9/site-packages/unitypack/assetbundle.py", line 197, in __init__
    self._seek(0)
  File "/usr/lib/python3.9/site-packages/unitypack/assetbundle.py", line 230, in _seek
    self.seek_to_block(new_cursor)
  File "/usr/lib/python3.9/site-packages/unitypack/assetbundle.py", line 256, in seek_to_block
    self.current_stream = self.current_block.decompress(buf)
  File "/usr/lib/python3.9/site-packages/unitypack/assetbundle.py", line 181, in decompress
    res = lz4_decompress(buf.read(self.compressed_size), self.uncompressed_size)
  File "/usr/lib/python3.9/site-packages/unitypack/utils.py", line 11, in lz4_decompress
    return decompress(data, size)
_block.LZ4BlockError: Decompression failed: corrupt input or insufficient space in destination buffer. Error code: 30236

Any ideas?

@Zedragon
Copy link

I'm also having the issue
_block.LZ4BlockError: Decompression failed: corrupt input or insufficient space in destination buffer. Error code: 16
ever since hearthstone update to 21.6 where they updated the unity engine. Does anyone have a solution

@sebastientromp
Copy link

I switched to UnityPy. I had to update my code, but the project is actively maintained and has an active Discord community, so it felt like a worthy investment.

@Milek7
Copy link

Milek7 commented Dec 9, 2021

diff --git a/unitypack/assetbundle.py b/unitypack/assetbundle.py
index 4c5a77c..8c6f7a1 100644
--- a/unitypack/assetbundle.py
+++ b/unitypack/assetbundle.py
@@ -98,6 +98,8 @@ class AssetBundle:
                self.ciblock_size = buf.read_uint()
                self.uiblock_size = buf.read_uint()
                flags = buf.read_uint()
+               if self.format_version >= 7:
+                       buf.seek((buf.tell() + 15) // 16 * 16)
                compression = CompressionType(flags & 0x3F)
                eof_metadata = flags & 0x80
                if eof_metadata:

(note that there are other differences in asset format that it still doesn't work fully, but I was only interested in block format)

SunsetMkt added a commit to SunsetMkt/blue-archive-spine that referenced this issue Jan 12, 2023
@hitfzyangdianshi
Copy link

maybe you can try to use this fork: https://github.com/CancerGary/UnityPack/tree/fix/2020.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants