Also, as far as copyright/patents are concerned those aren't a Problem with reverse engineering. If you reverse engineering something and you then discover copyrighted code while fixing a bug that's not a problem. Knowing of that code is not copying it.
If you were to copy that code or use knowledge you gained by reverse engineering to build your own product that would be an issue though.