diff options
| author | Vladislav HrĨka <41523109+nofiv@users.noreply.github.com> | 2020-05-21 21:01:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-21 21:01:57 +0200 |
| commit | 3fa97bf34640065c40c8a8640fb307c9beef2d5f (patch) | |
| tree | f0e001a8a9e508be3d52bd01f435849c76551be2 /miasm/expression/simplifications_common.py | |
| parent | 6b08a069e830951d0d5baed292948bb4cbefc811 (diff) | |
| download | focaccia-miasm-3fa97bf34640065c40c8a8640fb307c9beef2d5f.tar.gz focaccia-miasm-3fa97bf34640065c40c8a8640fb307c9beef2d5f.zip | |
simp_cmp_bijective_op improvement
Input expr such as "(ESP_init + 0xFFFFFFA8) == (ESP_init + @32[ESP_init + 0xFFFFFECC] * 0x2 + 0xFFFFFFA8)" resulted in empty args_a which caused "sanitycheck: ExprOp args must have same size!" in "arg_a = ExprOp(op, *args_a)".
Diffstat (limited to 'miasm/expression/simplifications_common.py')
| -rw-r--r-- | miasm/expression/simplifications_common.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/miasm/expression/simplifications_common.py b/miasm/expression/simplifications_common.py index f12ccfcf..f68b8ed5 100644 --- a/miasm/expression/simplifications_common.py +++ b/miasm/expression/simplifications_common.py @@ -1081,6 +1081,13 @@ def simp_cmp_bijective_op(expr_simp, expr): args_a.remove(value) args_b.remove(value) + # a + b == a + b + c + if not args_a: + return ExprOp(TOK_EQUAL, ExprOp(op, *args_b), ExprInt(0, args_b[0].size)) + # a + b + c == a + b + if not args_b: + return ExprOp(TOK_EQUAL, ExprOp(op, *args_a), ExprInt(0, args_a[0].size)) + arg_a = ExprOp(op, *args_a) arg_b = ExprOp(op, *args_b) return ExprOp(TOK_EQUAL, arg_a, arg_b) |