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

Failed to initialize: list index out of range #1

Open
CoffeeFlux opened this issue Apr 20, 2021 · 2 comments
Open

Failed to initialize: list index out of range #1

CoffeeFlux opened this issue Apr 20, 2021 · 2 comments
Assignees

Comments

@CoffeeFlux
Copy link

First, thanks for making the plugin! This would be a great addition to binja.

Attempting to load a wasm file results in the stack trace below:

Traceback (most recent call last):
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/binaryview.py", line 2164, in _init
    return self.init()
  File "/Users/ryan/Library/Application Support/Binary Ninja/plugins/binjawa/binaryview.py", line 34, in init
    wasm_module = from_bytes(wasm_bytes)
  File "/usr/local/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wasamole/io/__init__.py", line 9, in from_bytes
    return BinaryReader.from_bytes(the_bytes).read()
  File "/usr/local/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wasamole/io/reader/binary_format.py", line 56, in read
    self._read_section()
  File "/usr/local/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wasamole/io/reader/binary_format.py", line 83, in _read_section
    type_read_map[section_type](section_size)
  File "/usr/local/Cellar/[email protected]/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wasamole/io/reader/binary_format.py", line 96, in _read_custom
    self.module.functions[name_i].set_name(function_name)
IndexError: list index out of range
BinaryView of type 'WASM' failed to initialize!

I can't seem to upload the file itself to the Github issue, but if you give me an email I can send it your way.

@meadori-cs
Copy link
Contributor

Thank you for the report @CoffeeFlux ! I will be happy to take a look.

Did you try to attach the binary or text for of WASM? if binary, then maybe try converting it to text form with a .txt extension?

@meadori-cs meadori-cs self-assigned this Apr 28, 2021
@CoffeeFlux
Copy link
Author

Unfortunately, it's around 40MB in text form. It also seems that disassembling and reassembling actually results in the file not producing the same error, though it still seems to run into issues.

This link should hopefully work, though I'm not sure how long it will stay alive: https://pomf.lain.la/f/3krt3xg2.wasm

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

2 participants