Browse Source

Dedupe base / complete destructor aliases

nosoop 10 months ago
parent
commit
1aa6f143ba
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/smgdc/angr/vtable_disamb.py

+ 8 - 0
src/smgdc/angr/vtable_disamb.py

@@ -140,6 +140,14 @@ class VtableDisambiguator(angr.Analysis):
 
         rebased_fnsym_addrs = set(fnsym.rebased_addr for fnsym in ambig_fnsyms)
 
+        # if all the possible symbols are destructors, return based on priority
+        # this is technically unambiguous since GCC will always alias base/complete, but for the
+        # sake of this analysis there must be only one symbol for each entry
+        if all(dh.is_dtor(demangler.parse(sym.name)) for sym in ambig_fnsyms):
+            for dtype, sym in itertools.product(("complete", "base"), ambig_fnsyms):
+                if dh.get_dtor_type(demangler.parse(sym.name)) == dtype:
+                    return sym
+
         # prevent iterable from being consumed in the first iteration
         rel_vtsyms = set(related_vtsyms)
         for fnsym in ambig_fnsyms - non_class_syms: