From 54a3ed81837a6a04868073ca50dee0fdde0fcb2b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 14:31:27 +0100 Subject: [PATCH] [Lifter] Complex Type Lifting (#445) * Create draft PR for #444 * Switch Error fix and already lifted --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Spartak Ehrlich Co-authored-by: Niklas Bergmann <97505753+0x6e62@users.noreply.github.com> --- decompiler/frontend/binaryninja/handlers/globals.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/decompiler/frontend/binaryninja/handlers/globals.py b/decompiler/frontend/binaryninja/handlers/globals.py index 94fb77d0..344e0625 100644 --- a/decompiler/frontend/binaryninja/handlers/globals.py +++ b/decompiler/frontend/binaryninja/handlers/globals.py @@ -158,6 +158,10 @@ def lift_global_variable( if not self._view: self._view = view + # BNinja error cases: nullptr/small numbers (0, -12...) + if not addr_in_section(view, variable.address): + return Constant(variable.address, vartype=Integer(view.address_size * BYTE_SIZE, False)) + # If addr was already lifted: Return lifted GlobalVariable with updated SSA variable_identifier = (variable.address, self._lifter.lift(variable.type)) if variable_identifier in self._lifted_globals.keys(): @@ -167,10 +171,6 @@ def lift_global_variable( else self._lifted_globals[variable_identifier] ) - # BNinja error cases: nullptr/small numbers (0, -12...) - if not addr_in_section(view, variable.address): - return Constant(variable.address, vartype=Integer(view.address_size * BYTE_SIZE, False)) - # Check if there is a cycle between GlobalVariables initial_value if callers and variable.address in callers: return (