“Stack overflow” means that your recursive function calls itself too many times than the system can support it. Either you have an error, and recursion goes to infinity, or the function is correct, but just needs the depth that system currently can’t provide. We cannot tell which of the two is it until we see the code, and you tell us what the code is supposed to do.
solved C++ throwing exception in recursive algorithm