Browse Source

Fix enumeration of vtable function indices

nosoop 10 tháng trước cách đây
mục cha
commit
fe886b0017
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      src/smgdc/vtable.py

+ 3 - 3
src/smgdc/vtable.py

@@ -96,15 +96,15 @@ def get_vtables_from_address(bin: "LinuxBinary", vt: Symbol) -> list[VTable]:
 
     table_index = 0
     function_list: list[VTableFunction] = []
-    addr_range = iter(range(vt.rebased_addr, vt.rebased_addr + vt.size, 4))
-    for n, addr in enumerate(addr_range):
+    for n, addr in enumerate(range(vt.rebased_addr + 0x4 * 2, vt.rebased_addr + vt.size, 4)):
         # get symbols that map to that address
         deref = bin.angr.loader.fast_memory_load_pointer(addr)
         fnsyms = set(vtda.syms_by_addr.get(deref) or set()) if deref else set()
         if not fnsyms:
             # vtable boundary
+            # NOTE: we don't actually care if the indices skip; all that matters is that the
+            # functions are grouped correctly
             table_index += 1
-            next(addr_range)  # consume typeinfo
             continue
 
         if len(fnsyms) == 1 or not function_list: