Is it realistic to deal with a huge undocumented code base for master's project? I'm currently pursuing a Master's degree in a STEM field and working on a thesis. For my master's thesis, my advisor suggested I expand the code of the group's  software and add new features to it. However, is very large (some files are thousands of lines long) and hard to read. It consists of many different files  and there are hardly any comments that explain what the functions do,  the meaning of the variables, etc. There's no documentation that  explains what the functions/classes do. It seems like whenever I am focusing on  what a function does, there's multiple functions/variables in it that  are defined in another file and those functions/classes themselves are hundreds  of lines long

While my advisor has mentioned he is open to helping me with whatever  questions I have, most of the problems I'm having are related to the  code, since it's so gigantic and I don't even know where to begin to ask questions. But the prof doesn't know much about the  code, so I have to ask the postdoc whenever I have questions about the  code. However, the postdoc doesn't even know alot of the code (he knows c++, but most of the code was written by a former postdoc), and  told me I should email that former postdoc to  answer my questions about the code.

I've spoken to some people about this, and they've said this is a very bad situation. Should I leave this group and join a new one, even if it means I  have to delay my graduation by an extra semester(assuming that I will graduate on-time if I  continue with this current group)?

It's been a month since I joined this group and I hope to finish by next spring, but I don't know how realistic that goal is.
I would be very wary of taking on this thesis topic.  There's a huge amount of programming effort here, but you're not trying to get an MS in software engineering, so this will necessarily be a project in which you spend most of your time doing work that is actually outside of your discipline.  Furthermore, there's a risk that either you'll never be able to understand various aspects of the code or that you'll misunderstand things and then make changes that break the code.