Disclaimer: I am not a lawyer
Do I understand correctly that your situation is as follows:
- You worked for Company A.
- Company A developed a piece of software for Company B.
- You were part of Company A's project team that developed the software for Company B.
- Company B holds the copyright for software developed for them by Company A.
- You now work for Company B.
If this is an accurate description of your situation I don't see a problem as such. As long as your current employer holds the copyright to the code they can ask anyone to build upon it.
Any non-disclosure agreement you may have had with company A seems irrelevant, because company B holds the rights to the code and thus the information that your NDA was designed to protect.
The fact that you used to work for the company that they contracted to develop that code, is only relevant in as much as the contract between company A and B may have contained non-poaching and/or non-disclosure agreements.
Any non-disclosure agreement between them would have been to ensure that Company A would not use the information/knowledge it obtained during the project to expedite development for other clients and/or developement of a competetive product. As such it would seem irrelevant to your situation.
If there was a non-poaching agreement between your employers, either it doesn't cover you or you never told company A that you were moving to company B and you may already be in trouble regardless of what you work on.
I advise you to check with both your current and former employers whether your switch from company A to B and/or working on the project would get you in trouble (when checking with your former employer I would not tell them that you are already working for your current employer - you do not need to shoot yourself in the foot). If either gives a non-satisfactory (not a clear cut) answer, consult a lawyer yourself.