diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-16 15:05:55 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-16 15:05:55 +0200 |
| commit | f94c32b24795318b8c6fc17478ec88f72afa8f5d (patch) | |
| tree | 7e13a40d9cb9b902632ced3314d429e1230f86c5 | |
| parent | 5de25f4253208512e288d97a1d27a02ee410e5a4 (diff) | |
| download | miasm-f94c32b24795318b8c6fc17478ec88f72afa8f5d.tar.gz miasm-f94c32b24795318b8c6fc17478ec88f72afa8f5d.zip | |
vm2pe: fix min/max default address
| -rw-r--r-- | miasm2/jitter/jitload.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/miasm2/jitter/jitload.py b/miasm2/jitter/jitload.py index 86fe8f8c..e3b7e8d9 100644 --- a/miasm2/jitter/jitload.py +++ b/miasm2/jitter/jitload.py @@ -804,12 +804,17 @@ class jitter: def vm2pe(myjit, fname, libs=None, e_orig=None, - max_addr=1 << 64, min_addr=None, + min_addr=None, max_addr=None, min_section_offset=0x1000, img_base=None, added_funcs=None): mye = pe_init.PE() - if min_addr is None: - min_addr=e_orig.rva2virt(e_orig.SHList[0].addr) + + if min_addr is None and e_orig is not None: + min_addr = min([e_orig.rva2virt(s.addr) for s in e_orig.SHList]) + if max_addr is None and e_orig is not None: + max_addr = max([e_orig.rva2virt(s.addr + s.size) for s in e_orig.SHList]) + + if img_base is None: img_base = e_orig.NThdr.ImageBase @@ -869,4 +874,4 @@ def vm2pe(myjit, fname, libs=None, e_orig=None, log.debug('%s' % repr(mye.DirRes)) # generation open(fname, 'w').write(str(mye)) - + return mye |