Yes, it is safe to install your own custom ROM. But you need to ensure that the data that you are using is malware free.