From 539c98f8a662e21db6858cbb2150ebcd2b413828 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Fri, 3 Sep 2021 22:42:31 +0000 Subject: [PATCH] Properly initialize the stack when in 64bit mode. --- bemani/common/pe.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bemani/common/pe.py b/bemani/common/pe.py index 14e56d3..5096a7e 100644 --- a/bemani/common/pe.py +++ b/bemani/common/pe.py @@ -26,7 +26,7 @@ class Memory: class Registers: - def __init__(self) -> None: + def __init__(self, stack: int) -> None: self.rax = 0 self.rbx = 0 self.rcx = 0 @@ -34,7 +34,7 @@ class Registers: self.rsi = 0 self.rdi = 0 self.rbp = 0 - self.rsp = 0xFFFFFFFF + self.rsp = stack self.zf = False self.sf = False @@ -95,7 +95,7 @@ class PEFile: def vprint(*args: Any, **kwargs: Any) -> None: pass - registers = Registers() + registers = Registers(0xFFFFFFFFFFFFFFFF if self.is_64bit() else 0xFFFFFFFF) memory = Memory() formatter = Formatter(FormatterSyntax.NASM) # type: ignore