Skip to content

Commit

Permalink
fix(pclntab/func_ptr): Fix bug of func pointer parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
0xjiayu committed Nov 6, 2022
1 parent 4f7539a commit 415fce1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pclntbl.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ def parse(self, is_test=False):

def parse_func_pointer():
renamed = 0
possible_seg = ("rodata", "LOAD", ".rdata", ".data")

for segea in idautils.Segments():
for addr in idautils.Functions(segea, idc.get_segm_end(segea)):
Expand All @@ -693,7 +694,7 @@ def parse_func_pointer():
# Look at data xrefs to the function - find the pointer that is located in .rodata
data_ref = idaapi.get_first_dref_to(addr)
while data_ref != idc.BADADDR:
if 'rodata' in idc.get_segm_name(data_ref):
if idc.get_segm_name(data_ref) in possible_seg:
# Only rename things that are currently listed as an offset; eg. off_9120B0
if 'off_' in idc.get_name(data_ref):
if idc.set_name(data_ref, f"{name}_ptr", flags=idaapi.SN_FORCE):
Expand Down

0 comments on commit 415fce1

Please sign in to comment.