Here’s How Writing A Wrong Programming Code Can Prove To Be Fatal

Sometimes, when the programming of critical system malfunctions, it brings massive damage to stocks and property. Although most of the time this damage is on a low scale, sometimes the consequences are unimaginable. Here are some of the famous disasters which happened due to bad programming.


Anyone studying computer science may know about the Therac-25 report, a significant case study was given to students to understand how deadly negligence of a programmer can be. Therac-25 was a radiation therapy machine built in 1982 for treatment of aggressive forms of cancer. It was based on its earlier models namely Therac-6 and Therac-20. Therac-25 had a dual mode, one for a milder dose and second for a hundred times stronger dose.

The designers who built earlier models had the danger of overdose in their mind, so they had made a failsafe mechanism to prevent any risk. When the programmer of the Therac-25 copied the code from the older machine, he had no idea that whether the fail-safe would work as effectively on the new machine as it did on the previous one. The programmer of the previous device was a self-taught person and had left no comments for the future programmers to learn the working.

The previous programmer also left a flaw in the machine. If the technician missed a keystroke, the device could accidentally run in both modes, one followed by the other. So when this happens, instead of spreading the radiation over a larger area, the machine would blast a concentrated beam of radiation, leaving intense burn marks. The flaw killed at least five people.

The Patriot Missile That Didn’t Fire

In life, mistakes which seem to have no significant consequence rarely have one. Whereas in programming, the most straightforward error can cause a huge disaster. One of the most common programming mistakes is misusing a floating-point number. The issue with floating-point numbers is that it takes a minimal space in the memory and if the input is more substantial, the system cuts the number to fit it in the memory. Removing a few zero’s might not seem like a big deal to us, but for a computer, this mistake can become a disaster.

On February 25th, 1991, during the First Gulf War, a Military Patriot Missile Battery was appointed in Dhahran, Saudi Arabia to protect a military barrack from oncoming Iraqi SCUD missiles. The system was online for 100 hours without reboot. The system relied on a series of calculations to predict where the missile would be at any instant. To keep track of time elapsed, the program checked the time since boot-up every tenth of a second. The program then multiplied this integer by 1/10 to get their final answer, but this multiplication was a silly mistake right in the middle of a raging war.

This time was stored in a 24-bit memory such that any number larger than 24-bits would be cut short. Multiplying by 1/10 created a non-terminating binary representation and cutting it off introduced a drift of 0.000000095 seconds. After a hundred hours, this error added up to 0.34 seconds. When the SCUD missile passed, the system analyzed its location using the time with the error, and when the area was scanned, there was no missile. Assuming that SCUD had passed out of range, the counter-missile did not fire. SCUD hit the barrack killing 28 and injuring 100 more.

Digital Illusion

Just the way mistakes in coding can be deadly, testing can be lethal in the same way. Similar was the case in Panama City, Panama where doctors at the National Cancer Institute were using software built for medical purposes by a US Firm, Multidata Systems International. This software was being used to keep the outdated Cobalt-60 radiological equipment running. The machine was inadequate, and the doctors at the hospital were overworked and stressed and relied a lot on the software to determine the dose of radiation for the patients.

During the process, doctors had to look at a model of the patient on the screen and cover healthy parts of the body with metal plates to block radiation and then they had to draw rectangular blocks on the model onscreen. The most frustrating part was that the software allowed making of four blocks or less only whereas doctors wanted to make five. Doctors tried to find a way around. One doctor discovered that if they make the five blocks as one large block with a hole cut out where the smaller cutouts and larger rectangle met, they can fool the software.

What the doctors did not realize was that the software analyzed the blocks in a certain way and calculated the dosage accordingly. And what the programmers didn’t know was how one may draw shapes with overlapping sides, and what the direction of the drawing may be. When the program tried to read the form, it got confused as to what the shape was. The shape was like an optical illusion for the program, but even then the program calculated the dosage, the wrong dosage. The doctors went on with this technique for seven months, giving the double dose of radiation to an uncertain number of people. Out of 28 known victims, eight died and the rest severely injured. Because a lot of patients having this deadly disease got treated here, there is no way of knowing how many more got severely sick or died because of this error.

Looking at these 3 out of hundreds of more cases, it is crystal clear that the job of a programmer is not easy. Even the simplest of the mistakes can wreak havoc upon the user. That is why special care has to be taken while writing a program. Also, test running, and specialized training of user should be undertaken regularly