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

Fix binaryninja function iteration #161

Merged
merged 3 commits into from
Feb 2, 2023

Conversation

github-actions[bot]
Copy link
Contributor

closes #142

@github-actions github-actions bot added bug Something isn't working priority-high High priority issue labels Jan 19, 2023
@mm4rks
Copy link
Collaborator

mm4rks commented Jan 19, 2023

BinaryninjaFrontend._get_address("_1") may return an address to a DataSymbol. Leading to bv.get_function_at_address(<not an address related to function>) to return None.

This is caused by bv.symbols.get("_1", None) returning a list of DataSymbols and FunctionSymbols seemingly corresponding to the "_1" symbol.

However, the symbols_list for "_1" contains multiple FunctionSymbols, where only one is pointing to the correct function (others point to differently named functions).

If we want to go the route of resolving symbols, we could iterate this list and check for correct function names (and correct symbol type).
Or we could get function directly by name, and resolve symbols as a fallback.

@mm4rks mm4rks marked this pull request as ready for review January 22, 2023 12:00
@steffenenders steffenenders requested a review from 0x6e62 January 26, 2023 09:51
decompile.py Outdated Show resolved Hide resolved
decompiler/frontend/binaryninja/frontend.py Outdated Show resolved Hide resolved
decompiler/frontend/binaryninja/frontend.py Outdated Show resolved Hide resolved
decompiler/frontend/binaryninja/frontend.py Outdated Show resolved Hide resolved
@mm4rks mm4rks requested a review from 0x6e62 January 31, 2023 15:05
Marvin Marks added 3 commits February 2, 2023 10:23
BN may return a list of wrong symbols. Compare function name with symbol
name to obtain correct function.
@0x6e62 0x6e62 force-pushed the issue-142-Fix_binaryninja_function_iteration branch from b0f0539 to a04a606 Compare February 2, 2023 09:23
@0x6e62 0x6e62 merged commit 3f5d216 into main Feb 2, 2023
@0x6e62 0x6e62 deleted the issue-142-Fix_binaryninja_function_iteration branch February 2, 2023 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high High priority issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix binaryninja function iteration
2 participants