This a 32-bit Windows program crashes randomly. I debugged it with Visual Studio 2019. Here goes what I see.
After execution by clicking "Step Into":
It seems that the CPU breaks the instruction into 3 parts: 8B BB, 4C, F6 07 00
. What is 8B BB
? I confirm that the address [ebx +7F64C]
is valid and accessible.
Editing: If I click "Step Over", EDI
is not changed as expected. Add screenshots of registers.
To be closed: I realized that this problem is specific to the debugger that the breakpoint is in the middle of the instruction. The random crash is not related to this anyway.
UPDATE: The problem is caused by Visual Studio debugger. The debugger does not actually execute the code but emulate it. When a breakpoint is set in the middle of an instruction, it just gets confused and interprets the misaligned instruction.