(self, r, addr, cfg, annotatedcfg, ite_stmt: pyvex.IRStmt.WrTmp)
return jump_table, len(jump_table), entry_size
Try loading all jump targets from parsing an ITE block.
Try loading all jump targets from parsing an ITE block.
Try loading all jump targets from parsing an ITE block .
def _try_resolve_targets_ite(self, r, addr, cfg, annotatedcfg, ite_stmt: pyvex.IRStmt.WrTmp):  # pylint:disable=unused-argument
        """
        Try loading all jump targets from parsing an ITE block.
        """
        project = self.project

        try:
            whitelist = annotatedcfg.get_whitelisted_statements(r.addr)
            last_stmt = annotatedcfg.get_last_statement_index(r.addr)
            succ = project.factory.successors(r, whitelist=whitelist, last_stmt=last_stmt)
        except (AngrError, SimError):
            # oops there are errors
            l.warning('Cannot get jump successor states from a path that has reached the target. Skip it.')
            return None

        all_states = succ.flat_successors + succ.unconstrained_successors
        if not all_states:
            l.warning("Slicecutor failed to execute the program slice. No output state is available.")
            return None

        state = all_states[0]  # Just take the first state
        temps = state.scratch.temps
        if not isinstance(ite_stmt.data, pyvex.IRExpr.ITE):
            return None
        # load the default
        if not isinstance(ite_stmt.data.iffalse, pyvex.IRExpr.Const):
            return None
        # ite_stmt.data.iffalse.con.value is garbage introduced by the VEX ARM lifter and should be ignored
        if not isinstance(ite_stmt.data.iftrue, pyvex.IRExpr.RdTmp):
            return None
        if not isinstance(ite_stmt.data.cond, pyvex.IRExpr.RdTmp):
            return None
        cond = temps[ite_stmt.data.cond.tmp]
        # apply the constraint
        state.add_constraints(cond == 1)
        # load the target
        target_expr = temps[ite_stmt.data.iftrue.tmp]
        jump_table = state.solver.eval_upto(target_expr, self._max_targets + 1)
        entry_size = len(target_expr) // self.project.arch.byte_width

        if len(jump_table) == self._max_targets + 1:
            # so many targets! failed
            return None

        return jump_table, len(jump_table), entry_size
def _try_resolve_targets_ite ( self , r , addr , cfg , annotatedcfg , ite_stmt : pyvex . IRStmt . WrTmp ) : # pylint:disable=unused-argument project = self . project try : whitelist = annotatedcfg . get_whitelisted_statements ( r . addr ) last_stmt = annotatedcfg . get_last_statement_index ( r . addr ) succ = project . factory . successors ( r , whitelist = whitelist , last_stmt = last_stmt ) except ( AngrError , SimError ) : # oops there are errors l . warning ( 'Cannot get jump successor states from a path that has reached the target. Skip it.' ) return None all_states = succ . flat_successors + succ . unconstrained_successors if not all_states : l . warning ( "Slicecutor failed to execute the program slice. No output state is available." ) return None state = all_states [ 0 ] # Just take the first state temps = state . scratch . temps if not isinstance ( ite_stmt . data , pyvex . IRExpr . ITE ) : return None # load the default if not isinstance ( ite_stmt . data . iffalse , pyvex . IRExpr . Const ) : return None # ite_stmt.data.iffalse.con.value is garbage introduced by the VEX ARM lifter and should be ignored if not isinstance ( ite_stmt . data . iftrue , pyvex . IRExpr . RdTmp ) : return None if not isinstance ( ite_stmt . data . cond , pyvex . IRExpr . RdTmp ) : return None cond = temps [ ite_stmt . data . cond . tmp ] # apply the constraint state . add_constraints ( cond == 1 ) # load the target target_expr = temps [ ite_stmt . data . iftrue . tmp ] jump_table = state . solver . eval_upto ( target_expr , self . _max_targets + 1 ) entry_size = len ( target_expr ) // self . project . arch . byte_width if len ( jump_table ) == self . _max_targets + 1 : # so many targets! failed return None return jump_table , len ( jump_table ) , entry_size