question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

struct.error: unpack requires a buffer of 3714449519 bytes

See original GitHub issue

When running unityextract with ./bin/unityextract --audio -o out/audio2 /d/Games/Hearthstone/Data/Win/*.unity3d, I have the following stack trace:

Traceback (most recent call last):
  File "./bin/unityextract", line 159, in <module>
    main()
  File "./bin/unityextract", line 155, in main
    exit(app.run())
  File "./bin/unityextract", line 57, in run
    self.handle_asset(asset)
  File "./bin/unityextract", line 83, in handle_asset
    if obj.type not in self.handle_formats:
  File "C:\Users\Daedin\AppData\Local\Programs\Python\Python36\lib\site-packages\unitypack-0.9.0-py3.6.egg\unitypack\object.py", line 30, in type
    script = self.read()["m_Script"]
  File "C:\Users\Daedin\AppData\Local\Programs\Python\Python36\lib\site-packages\unitypack-0.9.0-py3.6.egg\unitypack\object.py", line 84, in read
    return self.read_value(self.type_tree, BinaryReader(BytesIO(object_buf)))
  File "C:\Users\Daedin\AppData\Local\Programs\Python\Python36\lib\site-packages\unitypack-0.9.0-py3.6.egg\unitypack\object.py", line 149, in read_value
    result[child.name] = self.read_value(child, buf)
  File "C:\Users\Daedin\AppData\Local\Programs\Python\Python36\lib\site-packages\unitypack-0.9.0-py3.6.egg\unitypack\object.py", line 149, in read_value
    result[child.name] = self.read_value(child, buf)
  File "C:\Users\Daedin\AppData\Local\Programs\Python\Python36\lib\site-packages\unitypack-0.9.0-py3.6.egg\unitypack\object.py", line 118, in read_value
    result = buf.read_string(size)
  File "C:\Users\Daedin\AppData\Local\Programs\Python\Python36\lib\site-packages\unitypack-0.9.0-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 buffer of 3714449519 bytes

This looked similar to https://github.com/HearthSim/UnityPack/issues/23, and I tried to re-clone unitypack and reinstall from scratch, but the issue still persists.

Do you have any idea how to fix this?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
nanoNagocommented, Jan 10, 2020

Seeing the same in another Unity project. It appears that although the asset metadata is parsed correctly, the type/tree information and/or the actual object reading function is not functioning correctly, and the actual data of the object is not correctly understood.

Haven’t discovered the root cause yet, but I’m looking into it (very slowly). If anyone wants to get in touch to debug and discuss improvements, I’d love to get in touch so we can make some improvements to unitypack.

0reactions
sebastientrompcommented, Jan 23, 2020

This looks solved now. So either one of the recent commits fixed it, or the last Hearthstone update did

Read more comments on GitHub >

github_iconTop Results From Across the Web

struct.error: unpack requires a buffer of 4 bytes - Stack Overflow
struct is used for binary packed data - data that is not human-readable. b'+001.80\r' is 8 bytes long: b'+', b'0', b'0', b'1', b'.',...
Read more >
Traceback (most recent call last): struct.error: unpack requires ...
struct.error: unpack requires a buffer of 12 bytes ... yeah, so your script is trying to read bytes out of a binary file,...
Read more >
Python - Struct module error | Sololearn: Learn to code for FREE!
I just tried to reproduce it and got an error saying unpack requires a buffer of 4 bytes. Here is the code, import...
Read more >
struct.error: unpack requires a buffer of 1 bytes - Bitcraze Forums
... line 307, in unpack_log_data unpackstring, log_data[data_index:data_index + size])[0] struct.error: unpack requires a buffer of 1 bytes
Read more >
struct.error: unpack requires a buffer of 14 bytes - Python Forum
struct.error: unpack requires a buffer of 14 bytes ... Hi, I am trying to read data from a socket and unpack it. But...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found