diff options
Diffstat (limited to 'miasm2')
| -rw-r--r-- | miasm2/analysis/binary.py | 2 | ||||
| -rw-r--r-- | miasm2/expression/expression_reduce.py | 10 | ||||
| -rw-r--r-- | miasm2/ir/symbexec.py | 10 |
3 files changed, 8 insertions, 14 deletions
diff --git a/miasm2/analysis/binary.py b/miasm2/analysis/binary.py index f5a727d7..5d9374da 100644 --- a/miasm2/analysis/binary.py +++ b/miasm2/analysis/binary.py @@ -202,6 +202,8 @@ class ContainerELF(Container): offset = symb.value if offset == 0: continue + if not name: + continue try: self._symbol_pool.add_location(name, offset) except ValueError: diff --git a/miasm2/expression/expression_reduce.py b/miasm2/expression/expression_reduce.py index 45386ca2..22ac8d8d 100644 --- a/miasm2/expression/expression_reduce.py +++ b/miasm2/expression/expression_reduce.py @@ -4,8 +4,8 @@ Apply reduction rules to an Expression ast """ import logging -from miasm2.expression.expression import ExprInt, ExprId, ExprOp, ExprSlice,\ - ExprCompose, ExprMem, ExprCond +from miasm2.expression.expression import ExprInt, ExprId, ExprLoc, ExprOp, \ + ExprSlice, ExprCompose, ExprMem, ExprCond log_reduce = logging.getLogger("expr_reduce") console_handler = logging.StreamHandler() @@ -29,7 +29,7 @@ class ExprNode(object): expr = self.expr if self.info is not None: out = repr(self.info) - elif expr.is_int() or expr.is_id(): + elif expr.is_int() or expr.is_id() or expr.is_loc(): out = str(expr) elif expr.is_mem(): out = "@%d[%r]" % (self.expr.size, self.arg) @@ -76,7 +76,7 @@ class ExprReducer(object): @expr: Expression to analyze """ - if isinstance(expr, (ExprId, ExprInt)): + if isinstance(expr, (ExprId, ExprLoc, ExprInt)): node = ExprNode(expr) elif isinstance(expr, (ExprMem, ExprSlice)): son = self.expr2node(expr.arg) @@ -118,7 +118,7 @@ class ExprReducer(object): expr = node.expr log_reduce.debug("\t" * lvl + "Reduce...: %s", node.expr) - if isinstance(expr, (ExprId, ExprInt)): + if isinstance(expr, (ExprId, ExprInt, ExprLoc)): pass elif isinstance(expr, ExprMem): arg = self.categorize(node.arg, lvl=lvl + 1, **kwargs) diff --git a/miasm2/ir/symbexec.py b/miasm2/ir/symbexec.py index 7ee55f97..c75bd9e8 100644 --- a/miasm2/ir/symbexec.py +++ b/miasm2/ir/symbexec.py @@ -1050,15 +1050,7 @@ class SymbolicExecutionEngine(object): print '_' * 80 dst = self.eval_expr(self.ir_arch.IRDst) - # Best effort to resolve destination as ExprLoc - if dst.is_loc(): - ret = dst - elif dst.is_int(): - label = self.ir_arch.symbol_pool.getby_offset_create(int(dst)) - ret = ExprLoc(label, dst.size) - else: - ret = dst - return ret + return dst def run_block_at(self, addr, step=False): """ |