Skip to main content

The Null Pointer Nightmare: How a Simple Mistake Can Halt The World

A global IT outage, described as “the largest IT outage in history” by Microsoft Regional Director Troy Hunt, occurred on July 19, 2024, affecting millions of Windows-based systems worldwide.

Imagine you’re driving on a highway, and suddenly, your GPS starts pointing to a nonexistent road. You keep driving, and before you know it, you're in a ditch because there was no road where your GPS pointed. Something similar happened with a recent CrowdStrike outage, but instead of a car, it involved lines of code, and instead of a ditch, it resulted in a system crash also called Blue screen of Death (BSOD).

Let’s dive into what happened, why it happened, and how we can avoid such nightmares in the future.

The Culprit: A Null Pointer

In the world of programming, a "pointer" is like a GPS for data. It points to a specific location in the computer’s memory where information is stored. In this case, a CrowdStrike developer wrote a piece of code that created a pointer. This pointer was supposed to point to an object—a kind of data structure with specific information. However, due to an oversight, the pointer remained "null."


Think of a null pointer as a GPS that has no destination set—it points to "nothing." But the program didn’t check if the GPS had a valid destination before trying to get there. When it tried to use this pointer to access the data, it essentially tried to read from "nowhere" in the computer's memory.








The Result: A System Crash

Because the pointer was null, trying to access data through it was like trying to find a non-existent road. The program attempted to read from an invalid memory address (0x9C in the technical jargon), which is like trying to drive on an imaginary road.

When the system recognised this invalid memory access, it panicked—rightfully so! To protect itself from potential harm, the system decided to crash the program entirely, resulting in what’s known as the Blue Screen of Death (BSOD). This is a safety measure, akin to your car shutting down to prevent further damage when it detects a critical issue.

How to Avoid Null Pointer Nightmares

So, how can we ensure our digital "GPS" always points to a real destination? Here are some straightforward strategies:

Always Set a Valid Destination:

Make sure pointers are always pointing to a valid memory address or set them to null initially and then check before use.

 

Check Before Using:

Before using a pointer, always check if it’s not null. This is like checking if your GPS has a valid route before you start driving.

Defensive Programming:

Always anticipate and check for potential errors. Use assertions and exceptions to handle unexpected null pointers gracefully. 

    

Conclusion
The CrowdStrike outage was a stark reminder of how a small mistake can cascade into a major issue. By following these best practices, both seasoned developers and newcomers can avoid null pointer nightmares.

Remember, in programming, as in life, always make sure your GPS has a valid destination before you hit the road!

Happy coding, and safe travels through the world of software development! 🚀


Comments

Popular posts from this blog

Cyber-warfare - The Fifth Dimension:

Today the World is talking about the use of Pegasus Software which has been allegedly used by Government agencies to manipulate and control institutions and Society. The Controversy is mired with suppositions, facts, false trials but also the kernel of the truth - has reignited the debate on Cyber Warfare. Pegasus is no ultimate form of cyberweapon but it has still awakened the Nations from their sleep and compelled them to ponder on the threat posed by these new-age weapons. Hominoids to Hominids [The Evolution]: One of the first instances of the use of this kind of Cyber weapon was in 1990. It was used by Israel's Intelligence Agency on one of the chief bomb makers of Hamas Abd-al Ayyash. A doctored phone was containing explosives was blown out when he got a call from an unknown  person.  This was a paradigm change in the usage of explosives. Before a lot of efforts were used to breach the area and plan the explosives with much risk and resources utilized. Later usage has mi...

"Our Infected Criminal Justice System"

If one reads a well established textbook of law, he understands the theory behind Criminal Justice System. Generally in India maintaining Criminal Justice System is the responsibility of all the organs of the Constitution, the Parliament which deals with the making of laws, the executive which controls the institutions involved in investigating the crime and last the Judiciary which decides on the culpability of the crime. Now understanding the edifice on which the Criminal Justice System is build upon let's move to the present day trends. Today their is a large question echoing in houses of India about the efficiency and efficacy of it ?  Atom is Disintegrating: Today the history has repeated itself and the era is of majoritarian government. The State through its power of absolute majority controls both the Parliament and the Executive i.e they are one who will make law and control the investigating machinery. Criminal Justice System without punishment is like a Atom without nucle...

"Those Little Invisible Fences"

  " If you think you can, you can & if you think you can't, you can't. "  These lines baffled me for the first time. But when I heard the story of 'Roger Bannister' everything started to make sense.  Back in 1945 in the world of athletics, it was dogma that no one could run a mile in less than four minutes. The best time was credited to  'Gunder Haegg'   from Sweden. He completed a mile in about 4 minutes and 1.4 seconds to be precise. There was a unanimous claim from several doctors, experts, and sports persons that  "No person can break this four-minute barrier."  Many Doctors claimed that it wouldn't be possible to outpace the run for less than four minutes without causing any physical damage to the human body. After five years on May 6th, 1950, there comes Roger who broke that four-minute barrier and accomplished an undefeated feat. He ran the mile in 3 minutes 59 seconds. He did what others said could never be possible. So, How i...