From b85bfedf61056dd4f4b2673e63b6425be8a18360 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Mon, 9 Feb 2015 12:44:37 +0100 Subject: Loader/Pe: fix section len computation --- miasm2/jitter/loader/pe.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'miasm2') diff --git a/miasm2/jitter/loader/pe.py b/miasm2/jitter/loader/pe.py index 6b19fc16..96df675c 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) -- cgit 1.4.1 From add2aed8428f8bf1c92ee705222e496fc06cad07 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Mon, 9 Feb 2015 12:45:36 +0100 Subject: Loader/PE: fix typo --- miasm2/jitter/loader/pe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'miasm2') diff --git a/miasm2/jitter/loader/pe.py b/miasm2/jitter/loader/pe.py index 96df675c..0b63583d 100644 --- a/miasm2/jitter/loader/pe.py +++ b/miasm2/jitter/loader/pe.py @@ -180,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 -- cgit 1.4.1