A software bug is a problem with the code in a computer program which makes it not work properly. They can cause inconvenience to the user and may make their computer crash or freeze. Most computer programs have bugs. A program that has a large number of bugs (or possibly a single or a few serious bugs) is said to be buggy.
Most bugs are caused by bad programming by the developer, but sometimes they can be caused by compiler problems. When bugs are found, people send bug reports to the developer to tell them about the bug and let them fix it.
Sometimes, people say that their computer has a bug when something is wrong with it. The problem is usually caused by a computer virus which has infected their computer and is making it slow or do different things.
Some bugs are harmless, for example, many video games incorrectly allow objects to move through walls. Other bugs are more severe, for example, a bug in a navigation system that causes an airplane to explode.
Types of bugs[change | change source]
Buffer overflow[change | change source]
A buffer overflow happens when a program writes to or reads from an area of memory that it is not supposed to access.
Arithmetic overflow[change | change source]
An arithmetic overflow happens when a number contained in a variable is increased beyond the highest number that the variable allows. This will usually cause the number to reset back to zero.
Infinite loop[change | change source]
An infinite loop happens when a program enters a loop (a series of instructions that is repeated many times) and there is no way out of the loop. This can cause the program to freeze.
Roundoff errors[change | change source]
If a floating point variable doesn't have enough precision, the number stored in it can be inaccurate. This can cause various problems depending on the type of program, for example it could cause a navigation program to navigate to an unintended location, or distorted sound in an audio recording program.
Division by zero[change | change source]
Division by zero is a invalid math operation. If a program divides an integer by zero, it will crash. On Linux, the message displayed when this bug occurs is "floating point exception", even though floating point numbers were not involved.
Clipping problems[change | change source]
In video games, clipping problems occur when an object passes through a barrier (such as a wall, floor, or ceiling) that it was not intended to pass through. This is a very common bug found throughout many video games. This can happen, for example, in Doom 2 when a crushed monster is resurrected by an arch-vile. Clipping problems can often be used as a time-saving tactic in speedruns, for example, in Super Mario 64 it is possible to skip walking up the spiral staircase in the castle by jumping through the ceiling.
Security bugs[change | change source]
Security bugs are bugs that allow an intruder to either gain access to the computer, or cause the computer to crash. Causing the computer to crash is called a denial-of-Service attack. Security bugs are considered especially important to fix because they might allow intruders to steal important information such as credit card numbers or passwords. Examples of security bugs include Heartbleed and Shellshock.
Misbugs[change | change source]
A misbug is a bug that has been used as a feature. An example would be a bug in an Android phone that allows users to gain root access.
Hardware bugs[change | change source]
Some bugs affect hardware (the physical parts of a computer) instead of software. For example, running the instruction
lock cmpxchg8b eax on old Pentium processors would cause the processor to stop working until rebooted. Since hardware bugs are physical design flaws, they can not be corrected with a software update, although it may be possible to work around (hide) the bug with a software update.