If you liked the post, Share on Facebook, Tweet and Google Plus (use buttons above). You can also Subscribe to our feed via Email for free.
Buffer Overflow and Underflow
If you are a computer science student or if your field is related with computer science then you might have often encountered with the words buffer overflow and buffer underflow(underrun). Let us understand the definition of overflow and underflow.
What is Buffer?
To understand buffer overflow and buffer underflow(commonly know as underrun), you must first understand what does buffer or data buffer means.
- Data Buffer
- In computer science, a data buffer is an area of a physical memory storage(usually in RAM) used to temporarily store data while it is being moved from one place to another.(generally from CPU to a device or from a device to CPU).
What is Buffer Overflow?
A buffer overflow also called buffer overrun, is a concept where a program or process, while writing data to a buffer, overruns the buffer's boundary and overwrites adjacent memory. This is a special case of violation of memory safety.
C programming Language and C++ does not provide any built-in protection against accessing or overwriting data in any part of memory and thus are the programming languages which are commonly associated with buffer overflows.
Buffer overflow is a basis of many software vulnerabilities and can be used to maliciously exploit the computer.
What is Buffer Underrun(Underflow)?
Buffer overflow is a condition in which the read/write buffer is fed with data at a slower rate than required.
It also happens when a signal to read a storage location in buffer is sent but that memory location has NULL value. This causes a program or device reading from the buffer to pause its processing while the buffer refills. This can cause undesired side-effects.