HearthSim / UnityPack

Python deserialization library for Unity3D Asset format

Home Page:https://hearthsim.info/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when unpacking string

agorgl opened this issue · comments

When trying use unity2yaml with the following file:
gd.data.zip

It goes on well, until some point it crashes on some object.
Reference trace:

Traceback (most recent call last):
  File "/home/theartist/.local/bin/unity2yaml", line 4, in <module>
    __import__('pkg_resources').run_script('unitypack==0.7.2', 'unity2yaml')
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 742, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1503, in run_script
    exec(code, namespace, namespace)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/EGG-INFO/scripts/unity2yaml", line 86, in <module>
    main()
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/EGG-INFO/scripts/unity2yaml", line 82, in main
    handle_asset(asset)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/EGG-INFO/scripts/unity2yaml", line 13, in handle_asset
    d = obj.read()
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 84, in read
    return self.read_value(self.type_tree, BinaryReader(BytesIO(object_buf)))
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 146, in read_value
    result[child.name] = self.read_value(child, buf)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 146, in read_value
    result[child.name] = self.read_value(child, buf)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 146, in read_value
    result[child.name] = self.read_value(child, buf)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 136, in read_value
    result.append(self.read_value(array_type, buf))
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 146, in read_value
    result[child.name] = self.read_value(child, buf)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/object.py", line 115, in read_value
    result = buf.read_string(size)
  File "/home/theartist/.local/lib/python3.6/site-packages/unitypack-0.7.2-py3.6.egg/unitypack/utils.py", line 70, in read_string
    ret = struct.unpack(self.endian + "%is" % (size), self.read(size))[0]
struct.error: unpack requires a bytes object of length 1684105299