From d9c73e8f3bc61934ecc23baa6fcde21880a03806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luke=20Sern=C3=A9?= Date: Sat, 31 Dec 2022 18:22:21 +0100 Subject: [PATCH] Clear memory before restore. This fixes #1136. --- qiling/os/memory.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qiling/os/memory.py b/qiling/os/memory.py index a2f01a2f8..aeb514bda 100644 --- a/qiling/os/memory.py +++ b/qiling/os/memory.py @@ -286,6 +286,9 @@ def restore(self, mem_dict): """Restore saved memory content. """ + # Unmap everything so we start with a clean memory state. + self.unmap_all() + for lbound, ubound, perms, label, data in mem_dict['ram']: self.ql.log.debug(f'restoring memory range: {lbound:#08x} {ubound:#08x} {label}')