This article does a good job summarizing why catastrophic software failures are inevitable given our current development practices. There’s an old engineering maxim that once a system becomes sufficiently complex, it will eventually fail no matter how much testing you do. This is why critical systems, such as medical equipment, are designed to “fail safe”.
Unfortunately, almost every application today depends on libraries developed by programmers who may be halfway across the world, which makes designing fail-safe software extremely challenging. Until we address this coordination problem, catastrophic failures like those mentioned in the article continue to be a real danger.