5 Simple Software Bugs That Have Caused Major Losses

Coding can be a tricky business. A missing semicolon somewhere in your code can be a reason for it to not compile. But not compiling is not is not an issue we will be talking about. Even after your code compiles, there may remain some errors. Such errors are run time errors. These errors or bugs may be triggered on a particular input and may remain dormant for others. This even applies for real-time applications. Developers invest substantial amount of time and effort in building and testing these softwares. Yet these softwares may contain bugs, as you can test a software for presence of bugs but not for their absence. Here I will tell you about some simple bugs that have caused some major losses in the history.

  1. Integer Overflow:As the name of this error suggests, this type of error occurs when you try to store a value larger than what an integer can store into an integer. Sounds very simple, but isn't. For example, Boeing 787 Dreamliner has an integer overflow bug that can shut all the electrical engines down if the aircraft was run for over 248 days. 
  2. Data Race: Data race is a condition where two or more threads try to access a shared variable and at-least one of them is performing a write operation. It has been a reason behind some of the most infamous software crashes in the history.


Data Race is a nasty bug. Often developers introduce these races to improve the performance of the system. Hence, not all these races are harmful and detecting the harmful ones is not an easy task as these bugs may be triggered only in a particular interleaving which may not execute in the testing of a software but may execute in a real time environment. Some notorious software crashes due to data races are:

a. Therac-25: In this case a cancer treatment machine "Therac-25" delivered lethal doses of radiations just because of a concurrency bug which ended up in causing deaths of over 5 patients.

b. PayPal bug : A simple concurrency bug caused a transfer of $92 quadrillion in to a user's account.

c. Northeast blackout of 2003: A simple concurrency bug caused a widespread power cut in northeastern and mid-western US.

3. Divide by Zero : This is one of the most famous arithmetic errors. When a number is divided by zero anywhere in your code it throws an exception. An example of software failure caused by divide by zero exception is Smart ship USS Yorktown, that was left dead in water for about 3 hours just because a crew member entered 0 into the database.

4. Index Out-of-bound: When we attempt to access an index in the data structure that is not valid, it leads to the index out of bound error. For example if an array had indexes 0 to 9, accessing index -1 or 10 would lead to this error. 

5. Null Pointer Exception: Using a variable that either contains or refers to a null value leads to a null pointer exception. Example:

void foo()
{
Object a = null;
a.x=10; /* null pointer exception reported here though a was assigned null in the previous statement*/
}