That's why you always have an independent backup system. One that uses different software, developed by a different team, using different languages, and different algorithms.
I thought one of the Viking landers was lost when a software update pointed the big antenna at Mars rather than at Earth... hard to send software updates after that.
I guess the worst thing you can fuck up in space fairing software is the boot loader. Mess that up and you can’t update the software.
Note: I have never designed software for space. I have no clue what I’m talking about.