roxaz
July 29th, 2008, 14:41
i noticed something weird while reversing one x64 app, look:
why the hell compiler stores registers in stack space that does not belong to the function? now i cant push anything on to the stack before calling this function cause my data is overwritten. whats worse is that some of my own compiled functions act like that, and this is not good because of reason i mentioned before. what makes compiler to act so weirdly? and is it possible to disable this? btw this code does not write data to arguments that are passed to the function, cause only one argument passed in rcx.
Code:
mov [rsp+8], rcx
mov rax, rsp
sub rsp, 98h
mov qword ptr [rsp+50h], 0FFFFFFFFFFFFFFFEh
mov [rax+18h], rbx
mov [rax+20h], rbp
why the hell compiler stores registers in stack space that does not belong to the function? now i cant push anything on to the stack before calling this function cause my data is overwritten. whats worse is that some of my own compiled functions act like that, and this is not good because of reason i mentioned before. what makes compiler to act so weirdly? and is it possible to disable this? btw this code does not write data to arguments that are passed to the function, cause only one argument passed in rcx.