diff options
| author | galenbwill <galenbwill@users.noreply.github.com> | 2021-07-15 12:29:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-15 12:29:51 -0400 |
| commit | 661d7c953e7a81e82f3eb6a70c03041354d73bfd (patch) | |
| tree | a924a5e0f9a0c4eb517e1848247ce5ec3e61d43f /python | |
| parent | ce08fff22e4bed3d977cfd662ed2a6d8caa82997 (diff) | |
Fix for create_user_function does not consult get_associated_platform_by_address when no platform is specified
Fix for https://github.com/Vector35/binaryninja-api/issues/2554#issue-945559859
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index a4b36f43..2c259741 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3067,7 +3067,9 @@ class BinaryView(object): """ if plat is None: - plat = self.platform + if self.platform is None: + raise ValueError("Can't create user function with no platform specified.") + plat, addr = self.platform.get_associated_platform_by_address(addr) return binaryninja.function.Function(self, core.BNCreateUserFunction(self.handle, plat.handle, addr)) def remove_user_function(self, func): @@ -3257,14 +3259,14 @@ class BinaryView(object): def get_functions_by_name(self, name, plat=None, ordered_filter=[SymbolType.FunctionSymbol, SymbolType.ImportedFunctionSymbol, SymbolType.LibraryFunctionSymbol]): """``get_functions_by_name`` returns a list of Function objects function with a Symbol of ``name``. - + :param str name: name of the functions :param Platform plat: (optional) platform :param list(SymbolType) ordered_filter: (optional) an ordered filter based on SymbolType :return: returns a list of Function objects or an empty list :rtype: list(Function) :Example: - + >>> bv.get_function_by_name("main")) <func: x86_64@0x1587> >>> |
