A bit of mathematics is a good start. There are certainly lots of mathematically-oriented free software projects out there that could use an extra hand.
A bit of programming is a problem. If you're new to templates and inheritance then by trying to do any design work you risk doing as much harm as good. Trying to contribute to Boost without being a C++ expert may not be a good idea.
But a bit of eagerness to contribute is a very good thing. The trouble with open source in general is that people focus on the fun work first and the necessary support work second and then leave the grunt work for third or for never. You should have no trouble finding projects that don't have a big enough test suite (or finding projects that don't have any test suite, for that matter), and unit tests and regression tests are something you can create that will teach you libraries that you can use in your own research apps, expose you to others' good code, give you a chance to practice writing your own good code, but still not leave you responsible for creating tricky designs or performance-critical implementations yourself yet.
If you want to contribute to a mathematical open source C++ project which has helpful people on the mailing lists and on Slashdot, my biased suggestion is libMesh. There are lots of other good suggestions here, though; my unbiased advice would be to think ahead to your possible dissertation research topics and pick something that is likely to be useful for them. Doing intellectually stimulating things for fun is great (otherwise you wouldn't want to be a grad student), but it's also good to keep an eye out for when "fun" and "personally useful" can overlap.