Recently, I've been in a few situations where I needed to quickly come up to speed on old code and fix it sufficiently for people to be able to use it again. The code I've worked on tends to have the usual issues (no documentation, no tests, etc.), but compounding this is that I often have absolutely no idea (on a technical level) what the code does.
For example, I was recently tasked with fixing some software that did something called "stress analysis". Even after extensive googling, I still ended up getting hopelessly lost in the code itself and taking weeks to fix what were probably simple bugs (and I wasn't totally confident about the fixes either).
In situations where you need to fix code which does something you don't understand (and don't have time to learn the material), what are some best practices?
I think this is different from What is the most effective way to add functionality to unfamiliar, structurally unsound code? (which is a duplicate of two others) in that I'm not necessarily looking to improve the code. Typically, I'm trying to do two things:
Run the code. Although it sounds simple, I find it to be one of the most challenging parts, particularly if there's no GUI (or my personal favorite - a GUI which isn't hooked up to the code) or if it requires a file format I'm not familiar with.
Ensure that what I think is a bug is, in fact, a bug. This is most nerve-wracking when I'm looking at "truth tables" in the code or logic flow.