Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between STATUS_STACK_BUFFER_OVERRUN and STATUS_STACK_OVERFLOW?

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

like image 800
Tobias Langner Avatar asked Oct 11 '12 10:10

Tobias Langner


People also ask

What is Status_stack_buffer_overrun?

STATUS_STACK_BUFFER_OVERRUN is one of the exit codes used for the feature. The fact your program aborted with this means your program's memory is somehow corrupted. It is a bug of either your program, a bug of a library used by your program, or a bug of tool (such as compiler or linker) used to build your program.


1 Answers

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.

like image 69
paxdiablo Avatar answered Oct 03 '22 15:10

paxdiablo