问题
I just found out that there is a STATUS_STACK_BUFFER_OVERRUN and a STATUS_STACK_OVERFLOW. What's the difference between those 2? I just found Stack overflow (stack exhaustion) not the same as stack buffer overflow but either it doesn't explain it or I don't understand it. Can you help me out?
Regards Tobias
回答1:
Consider the following stack which grows downward in memory:
+----------------+
| some data | |
+----------------+ | growth of stack
| 20-byte string | V
+----------------+
limit of stack
A buffer overrun occurs when you write 30 bytes to your 20-byte string. This corrupts entries further up the stack ('some data').
A stack overflow is when you try to push something else on to the stack when it's already full (where it says 'limit of stack'). Stacks are typically limited in their maximum size.
回答2:
Stackoverflow
appears when there is no more space in memory to allocate your data, and buffer overrun
a.k.a. buffer overflow
is called when program overruns buffer boundary and writes/overwrites data in unexpected part of memory (takes more memory than expected).
Easily, you can understand this just by reading description of tags stackoverflow and buffer overflow.
来源:https://stackoverflow.com/questions/12837134/what-is-the-difference-between-status-stack-buffer-overrun-and-status-stack-over