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

Avoid applying local labels as function name. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions ApplySig.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ def parse_public_function(f, version, offset):
is_local = True
if b & FlirtFunctionFlag.FUNCTION_UNRESOLVED_COLLISION:
is_collision = True
if b & 0x01 or b & 0x04:
print('Investigate public name flag: 0x{:02X} @ 0x{:04X}'.format(b, offset))
# if b & 0x01 or b & 0x04:
# print('Investigate public name flag: 0x{:02X} @ 0x{:04X}'.format(b, offset))
b = read_u8(f)

name = list()
Expand Down Expand Up @@ -696,9 +696,14 @@ def funk_rename(addr, funk):
global rename_cnt
name = funk.name
if name != '?':
funk = getFunctionAt(parseAddress(hex(addr)))
funk.setName(name, SourceType.USER_DEFINED)
rename_cnt += 1
if not funk.is_local:
ghidra_funk = getFunctionAt(parseAddress(hex(addr + funk.offset)))
if ghidra_funk:
ghidra_funk.setName(name, SourceType.USER_DEFINED)
rename_cnt += 1
else:
# No current defined function at address
pass
return

def apply_sig(flirt):
Expand Down