I believe that sandstone is usually perfectly safe, it's just cemented sand and would be no different than putting sand in your tank. Due to the nature of sandstone I suppose that some other nasty particles could mix with the silica dioxide, sand, when the rock is forming, though I think this is a fairly low proabibility, since the minerals that form sandstone would be well whethered and usually only the most stable minerals survive, namely the sand.
However I don't think that limestone would be a good addition to the tank, it is Calcium carbonate, CaCO3, and that would rise your carbonate hardness or KH. A way to test for limestone, or it's metamorphic rock cousin marble, is with a solution of HCl, Hydrochloric Acid. If you have an API test kit API Nitrate test bottle #1 is a HCl solution. Put a drop on the rock, if it fizzes it means that it has CO3 in in and probably shouldn't be put in the tank.