diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2020-07-17 06:50:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-17 06:50:04 +0200 |
| commit | 92eb2392f274c83c731286f41b74aa1d8eafbb5b (patch) | |
| tree | 1ae7dc1cecf181f5ee44e3ef8e9f8401bbb814c5 | |
| parent | 67d5d6686e1f1ea2a3f810e42d2d03c3fe91125d (diff) | |
| parent | 1d24520ebfe25e5cdc89740ca694e15f36649de9 (diff) | |
| download | miasm-92eb2392f274c83c731286f41b74aa1d8eafbb5b.tar.gz miasm-92eb2392f274c83c731286f41b74aa1d8eafbb5b.zip | |
Merge pull request #1264 from eset/fix_fname_type_error_in_dse
Bug fix - tuples need to be converted to str before using force_bytes
| -rw-r--r-- | miasm/analysis/dse.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/miasm/analysis/dse.py b/miasm/analysis/dse.py index 9cc342c7..4d2655df 100644 --- a/miasm/analysis/dse.py +++ b/miasm/analysis/dse.py @@ -250,7 +250,7 @@ class DSEEngine(object): def add_lib_handler(self, libimp, namespace): """Add search for handler based on a @libimp libimp instance - Known functions will be looked by {name}_symb in the @namespace + Known functions will be looked by {name}_symb or {name}_{ord}_symb in the @namespace """ namespace = dict( (force_bytes(name), func) for name, func in viewitems(namespace) @@ -258,12 +258,18 @@ class DSEEngine(object): # lambda cannot contain statement def default_func(dse): - fname = b"%s_symb" % force_bytes(libimp.fad2cname[dse.jitter.pc]) + fname = libimp.fad2cname[dse.jitter.pc] + if isinstance(fname, tuple): + fname = b"%s_%d_symb" % (force_bytes(fname[0]), fname[1]) + else: + fname = b"%s_symb" % force_bytes(fname) raise RuntimeError("Symbolic stub '%s' not found" % fname) for addr, fname in viewitems(libimp.fad2cname): - fname = force_bytes(fname) - fname = b"%s_symb" % fname + if isinstance(fname, tuple): + fname = b"%s_%d_symb" % (force_bytes(fname[0]), fname[1]) + else: + fname = b"%s_symb" % force_bytes(fname) func = namespace.get(fname, None) if func is not None: self.add_handler(addr, func) |