If I have a call procedure on asm:
push ebp
mov ebp esp
sub ebp, 8
Can I assume right now that both [ebp-4] and [ebp-8] are initialized to zero, or can they have random values?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They will have whatever value was in that memory before, which is unlikely to be
0. This is not ‘random’ per se – indeed, it’s probably somewhat predictable; this usually doesn’t do any good, but just don’t get any clever ideas about using it for a RNG 🙂Remember, all you did in that code was:
The CPU won’t read anything into this beyond that, unless you tell it to. That is the essence of assembler. Moreover, when used in normal arithmetic, ESP is not special cased at all – it’s just a number.