What is the difference between STATUS_STACK_BUFFER

2019-04-07 00:04发布

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

2条回答
霸刀☆藐视天下
2楼-- · 2019-04-07 00:24

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.

查看更多
Viruses.
3楼-- · 2019-04-07 00:31

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.

查看更多
登录 后发表回答