Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Commit b49bfa3

Browse files
committed
Fix get_func_name and test_
1 parent 5d2a082 commit b49bfa3

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

idb/idapython.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,12 +1821,11 @@ def get_func_name(self, ea):
18211821
if func is None:
18221822
return ""
18231823

1824-
ea = func.startEA
1825-
18261824
# shouldn't be a chunk
1827-
if is_flag_set(func.flags, func.FUNC_TAIL):
1825+
if is_flag_set(func.flags, func.FUNC_TAIL) or ea != func.startEA:
18281826
raise KeyError(ea)
18291827

1828+
ea = func.startEA
18301829
nn = self.api.ida_netnode.netnode(ea)
18311830
try:
18321831
return nn.name()

tests/test_idaapi.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -583,11 +583,10 @@ def test_function_names(kernel32_idb, version, bitness, expected):
583583
else "__BaseDllInitialize@12"
584584
)
585585

586-
if version >= 720:
587-
assert api.idc.GetFunctionName(0x689018E5) == "_InternalFindAtom@12"
588-
elif version > 500:
589-
assert api.idc.GetFunctionName(0x689018E5) == "sub_689017d4"
590-
elif version == 500:
586+
if version > 500:
587+
with pytest.raises(KeyError):
588+
api.idc.GetFunctionName(0x689018E5)
589+
else:
591590
assert api.idc.GetFunctionName(0x689018E5) == "sub_689018e5"
592591

593592

0 commit comments

Comments
 (0)