That said, I don't think it's normal for a "software bug" to result in such an egregious error as to require a retraction of the study. I'd like to know why the peer review process failed to detect the problem.
Only because most papers never get the work checked at that level. Software bugs causing errors in studies is extremely common. There's a reason a tiny tiny fraction of researchers share their code without kicking and screaming, and it's not because they'll be scooped on their next paper if they do. (I'm slightly jaded here)
That being said, as a writer I might not be able to resist pointing out the irony that the paper on fake news was fake news :). I really can't fault the author.
/fāk/
adjective
1. not genuine; counterfeit.
"fake designer clothing"
synonyms: forgery, counterfeit, copy, sham, fraud, hoax, imitation, mock-up, dummy, reproduction, lookalike, likeness;
A Bug in FMRI Software Could Invalidate 15 Years of Brain Research [1]
[1]: https://www.sciencealert.com/a-bug-in-fmri-software-could-in...
Part of the purpose for publishing in the first place is to see if other people can find mistakes in your logic. This is particularly the case at the real frontiers of science and theoretical mathematics, where truly new ground is being broken. Computer-aided theorem provers would like to improve this, but they are currently fairly specialized tools with limited use.
It was the demands of early primitive and unreliable computing hardware that forced developers to focus on provable software correctness: it was the best way to find hardware bugs! Dijkstra has a great monograph on developing early interrupt handling correctly. More people should read it, since as anyone who has worked with Unix signals knows, it's easy to get wrong in subtle and nasty ways.
Edit: Also to speak to the pure math point, Dijkstra's official title after graduating was "Mathematical Engineer."
Regarding Dijkstra, I personally consider TCS to be a branch of applied math or maybe applied logic. What most programmers do in practice, however, is more akin to engineering (or I'd say, is a type of engineering).