The only reason there would be stack corruption based on the parameters to main is if it's a "callee clean stack" function. In x86 that isn't the common case, although Windows __stdcall calling convention does that. However, main is not a __stdcall function, so it's the responsibility of the caller to clean up the stack.
Other architectures may vary of course, depending on what the functionality that different instructions offer. But C-code basicly requires caller-stack-cleanup because of the ability to take variable number of arguments - the called function may not know [from a static analysis standpoint] the number of arguments, so the clean-up will need to be in the calling code for these functions at the very least.
--
Mats



LinkBack URL
About LinkBacks




