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

ERROR: unpack requires a buffer of 2 bytes (HBC Version: 89) #8

Open
gonzalo-hvega opened this issue Dec 3, 2022 · 2 comments
Open

Comments

@gonzalo-hvega
Copy link

Hi, I am trying to to reverse an APK which contains HBC Version 89, however I get the following error while it tries to unpack the instruction.hasm:

Traceback (most recent call last):
File "runpy.py", line 193, in run_module_as_main
File "runpy.py", line 85, in run_code
File "D:\Programs\Python-3.6.8\Scripts\hbctool.exe_main
.py", line 7, in
File "d:\programs\python-3.6.8\lib\site-packages\hbctool_init
.py", line 61, in main
disasm(args['<HBC_FILE>'], args['<HASM_PATH>'])
File "d:\programs\python-3.6.8\lib\site-packages\hbctool_init_.py", line 41, in disasm
hasm.dump(hbco, hasmpath)
File "d:\programs\python-3.6.8\lib\site-packages\hbctool\hasm.py", line 67, in dump
write_func(f, hbc.getFunction(i), i, hbc)
File "d:\programs\python-3.6.8\lib\site-packages\hbctool\hbc\hbc89_init_.py", line 59, in getFunction
insts = disassemble(bc)
File "d:\programs\python-3.6.8\lib\site-packages\hbctool\hbc\hbc89\translator.py", line 43, in disassemble
val = conv_to(bc[i:i+size])
File "d:\programs\python-3.6.8\lib\site-packages\hbctool\util.py", line 300, in to_uint16
return unpack("<H", bytes(buf[:2]))[0]
struct.error: unpack requires a buffer of 2 bytes

@hab12335
Copy link

Same problem here, altough in my apk it's in "to_uint8"

@Happ1ness-dev
Copy link

Hi, I am trying to to reverse an APK which contains HBC Version 89, however I get the following error while it tries to unpack the instruction.hasm:

Traceback (most recent call last): File "runpy.py", line 193, in run_module_as_main File "runpy.py", line 85, in run_code File "D:\Programs\Python-3.6.8\Scripts\hbctool.exe__main.py", line 7, in File "d:\programs\python-3.6.8\lib\site-packages\hbctool__init__.py", line 61, in main disasm(args['<HBC_FILE>'], args['<HASM_PATH>']) File "d:\programs\python-3.6.8\lib\site-packages\hbctool__init__.py", line 41, in disasm hasm.dump(hbco, hasmpath) File "d:\programs\python-3.6.8\lib\site-packages\hbctool\hasm.py", line 67, in dump write_func(f, hbc.getFunction(i), i, hbc) File "d:\programs\python-3.6.8\lib\site-packages\hbctool\hbc\hbc89__init__.py", line 59, in getFunction insts = disassemble(bc) File "d:\programs\python-3.6.8\lib\site-packages\hbctool\hbc\hbc89\translator.py", line 43, in disassemble val = conv_to(bc[i:i+size]) File "d:\programs\python-3.6.8\lib\site-packages\hbctool\util.py", line 300, in to_uint16 return unpack("<H", bytes(buf[:2]))[0] struct.error: unpack requires a buffer of 2 bytes

Having the same issue here.
Did anyone find a fix for it?

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

No branches or pull requests

3 participants