One of the things that are more susceptible to cause stack overflows are recurrent calls to routines.
If the stack is used mainly to keep the addresses of returning calls, it could be a good option to limit the number of calls to a safe recurrent depth, like no more than 512 calls, and have a wrapper that, when this number is reached, refuses to keep calling and end the program.