diff options
| author | Camille Mougey <commial@gmail.com> | 2015-02-10 13:30:01 +0100 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2015-02-10 13:30:01 +0100 |
| commit | 541a89120f963a1a5cb7bc4e9808c33da982dfd2 (patch) | |
| tree | ddc51b6a469ad77792f501f4f83c4ed734e617be | |
| parent | b9c7954bc3ec3ca237cdaee5fa9c859df3954383 (diff) | |
| parent | add2aed8428f8bf1c92ee705222e496fc06cad07 (diff) | |
| download | miasm-541a89120f963a1a5cb7bc4e9808c33da982dfd2.tar.gz miasm-541a89120f963a1a5cb7bc4e9808c33da982dfd2.zip | |
Merge pull request #58 from serpilliere/fix_loader
Fix loader
| -rw-r--r-- | miasm2/jitter/loader/pe.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/miasm2/jitter/loader/pe.py b/miasm2/jitter/loader/pe.py index 6b19fc16..0b63583d 100644 --- a/miasm2/jitter/loader/pe.py +++ b/miasm2/jitter/loader/pe.py @@ -164,8 +164,9 @@ def vm_load_pe(vm, fdata, align_s=True, load_hdr=True, **kargs): # Update min and max addresses if min_addr is None or section.addr < min_addr: min_addr = section.addr - if max_addr is None or section.addr + section.size > max_addr: - max_addr = section.addr + max(section.size, len(section.data)) + max_section_len = max(section.size, len(section.data)) + if max_addr is None or section.addr + max_section_len > max_addr: + max_addr = section.addr + max_section_len min_addr = pe.rva2virt(min_addr) max_addr = pe.rva2virt(max_addr) @@ -179,8 +180,8 @@ def vm_load_pe(vm, fdata, align_s=True, load_hdr=True, **kargs): # Copy each sections content in memory for section in pe.SHList: - log.debug('Map 0x%x bytes to 0x%x' % (len(s.data), pe.rva2virt(s.addr))) - vm.set_mem(pe.rva2virt(s.addr), str(s.data)) + log.debug('Map 0x%x bytes to 0x%x' % (len(section.data), pe.rva2virt(section.addr))) + vm.set_mem(pe.rva2virt(section.addr), str(section.data)) return pe |