+ 2
buffer overrun
Hi Is buffer overrun same as stack overflow? If not, what is buffer overrun? Thanks in advance..!
1 Answer
+ 3
Think of a buffer as just an array.
A buffer overflow is when you try to put more items in the array than the array can hold. It comes from writing.
A buffer overrun is when you are iterating over the buffer and keep reading past the end of the array. It comes from reading.
A stack overflow is much different. Most modern programming environments are stack-based, where they use a stack data structure to control program flow. Every time you call a function, a new item is placed on the program's call stack. When the function returns, the item is popped from the stack. When the stack is empty, the program stops. The thing is, this stack has a limited size. It is possible to call too many functions at one time and fill up the stack. At this point you have a stack overflow. The most common way to do this is when a function calls itself (recursion).
Take a look at:
https://stackoverflow.com/questions/1144088/buffer-overflow-vs-buffer-overrun-vs-stack-overflow