Open source firmware, namely OpenWRT and dd-wrt are supposed to be more secure and "open" than the stock firmware. After all, they are based in open source. And poised to over time, having more regular updates than the stock firmware. They also have a very strong and active community.
They are supposed to improve you security outlook, and you can disable/customise much more things than in the original firmware.
They often also bring more functionalities than the original firmware; on the other hand they can miss others.
dd-wrt is strongly oriented to more unexperienced users, openwrt to die hard system administrators and developers. With openwrt, you manage it pretty much like another Linux distribution system; on the other hand you can manage dd-wrt even in your iphone with a nice interface. However, openwrt already gets a nice web interface, and if it has a far much more recent version than dd-wrt, I would advise considering it.
I myself have a TP-Link with openWRT, and have customised it a lot in the command line. The installation was painless. OpenWrt allows to use VLANs in the switch chip at will, which was not certainly the case with the default stock firmware, however does not allows to handle NAT in some accelerator chip, which makes absolutely no difference to me as I am doing NAT in another router.
Nevertheless, it would not make much of a difference even doing NAT there. Openwrt also allows me to install software for debugging problems more effectively, and eventually using a more interesting 802.1X setup than the default hardware, which has some limitations handling 802.1X.
On the wifi side, the protocols attacks are pretty much the same. On my model default firmware and in openwrt, you can create an isolated guest network and give a different password to visitors, your mileage may vary.
I myself trust more openWRT than the stock firmware that came with the TP-Link. The security records of appliance vendors is not one of the brightest - and backdoors are aplenty - ; often they only care about sales, and stop supporting updates after a very short while.
As a last side note, my own OpenWRT administration IP is in a VLAN that is not allowed to talk with the Internet.
disclaimer: I am not saying I do believe it is completely secure, however I am inclined to trust it more than the firmware from the vendor.