views:

133

answers:

2

Possible Duplicate:
What is a stack overflow error?

Well, I have heard its the most common error that one experiences while writing a program... I am very new to programming, just 2 years coding and I have never actually come across this error! So, at the risk of sounding very stupid, I would like to ask... What is stackoverflow and what is bufferoverflow?

Is stackoverflow somehow related to bufferoverflow?

A wiki link will literally not help me coz I have gone through it and am did not understand it. So if you could dumb it down.... How would you put it?

+5  A: 

Most operating system hold program information in data stuctures called a stack and a heap.

A StackOverflow occurs when one has added more information to the stack than it is allowed to hold (many times this can happen with a recursive function the doesn't have a termination clause).


A buffer is a set of memory locations (normally contiguous) that is used to hold temporary data. A buffer overflow occurs when trying to write into memory beyond the end of the buffer. This has security implications, as sometimes the memory beyond the buffer is not protected and code inserted after it may get executed.

Oded
+1  A: 

A StackOverflow is what happens when you run out of stack space for you programme to execute in.

I got one the other day with some poorly written event code, where one event would trigger another event causing the original event, and so on, until the stack overflowed with method calls.

A buffer overflow or buffer overrun is what happens when you try to write data past the end of an array. For example

char* s = "hello";
s[7] = 'g';

There is no knowing what writing 'g' to the location 7 in the string will do. This technique can be used by nefarious programmers to execute arbitrary code on a system.

Matt Ellen