Skip to content

Commit

Permalink
robust handling of lifting setting of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
blattm committed Oct 13, 2023
1 parent 6962e1e commit 6c6705a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions decompiler/frontend/binaryninja/handlers/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
RegisterPair,
UnaryOperation,
)
from decompiler.structures.pseudo.complextypes import Struct, Union
from decompiler.structures.pseudo.complextypes import Struct, Union, Class
from decompiler.structures.pseudo.operations import MemberAccess


Expand Down Expand Up @@ -67,9 +67,8 @@ def lift_set_field(self, assignment: mediumlevelil.MediumLevelILSetVarField, is_
"""
# case 1 (struct), avoid set field of named integers:
dest_type = self._lifter.lift(assignment.dest.type)
if isinstance(assignment.dest.type, binaryninja.NamedTypeReferenceType) and not (
isinstance(dest_type, Pointer) and isinstance(dest_type.type, Integer)
):
if isinstance(assignment.dest.type, binaryninja.NamedTypeReferenceType) and (
isinstance(dest_type, Struct) or isinstance(dest_type, Class)): # otherwise get_member_by_offset not available
struct_variable = self._lifter.lift(assignment.dest, is_aliased=True, parent=assignment)
destination = MemberAccess(
offset=assignment.offset,
Expand Down

0 comments on commit 6c6705a

Please sign in to comment.