I have never seen this but i had this thing in my mind!
stack memory error here could be a memory corruption also.
lets say there is a stack overflow in a c/c++ program.
does it create a core dump file?
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.
It depends on the operating system and language runtime. I’ll assume you’re talking about some flavour of Unix/Linux, since you mention a core dump.
Typically, there will be some amount (perhaps a single page) of unmapped virtual memory beyond the stack. If you overflow by less than that amount, then the program will attempt to access that, giving a segmentation fault. If the program doesn’t handle the signal, then it will abort; and if core dumps are enabled, then one will be produced. You may need to enable core dumps, perhaps using
ulimit -c unlimitedfrom the shell you use to launch the program.If you overflow by a large amount, then you may instead overwrite some other part of the program’s memory. If this happens, then all bets are off; the program could crash, or could continue in a corrupt state and cause any kind of damage at any point in the future.
That’s assuming that, by “overflow” you mean using more stack memory than has been allocated by some combination of a deep call stack and large automatic objects. If you’re talking about writing to the wrong part of the stack (e.g. by an out-of-bounds access to an automatic array), then you’ll typically get random memory corruption rather than a segmentation fault; again, the program might shamble on in a corrupt state with unpredictable results.