From 93d6953fa02230bf96ab698c8aba1cf4a3c72102 Mon Sep 17 00:00:00 2001 From: SakuraDerek Date: Sat, 14 Oct 2023 23:19:42 +0800 Subject: [PATCH] fix: scan_pattern_page read bytes out of range. --- pymem/pattern.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymem/pattern.py b/pymem/pattern.py index afbee6b..b495dc3 100644 --- a/pymem/pattern.py +++ b/pymem/pattern.py @@ -63,7 +63,7 @@ def scan_pattern_page(handle, address, pattern, *, return_multiple=False): if mbi.state != pymem.ressources.structure.MEMORY_STATE.MEM_COMMIT or mbi.protect not in allowed_protections: return next_region, None - page_bytes = pymem.memory.read_bytes(handle, address, mbi.RegionSize) + page_bytes = pymem.memory.read_bytes(handle, address, mbi.RegionSize - (address - mbi.BaseAddress)) if not return_multiple: found = None