The term "fresh" egg as far as commercial supermarket eggs go is an enigma at best, as those eggs can be stored for quite some time in refrigerated warehouses before being sold, & yet can still be marketed as "fresh". You can easily tell the freshness of your eggs when you crack them into a pan or bowl. A truly fresh egg will have a yolk surrounded by a high compact white - sometimes not much bigger than the yolk itself. As the egg ages, the yolk becomes flatter & more watery, thus starts spreading all over the pan. Very few supermarket eggs DON'T do this, which alone should tell you how old they already are. It's an unfortunate fact that commercial egg producers take full advantage of the fact that properly stored eggs can remain edible for an unbelievably long time. However, that spreading does NOT mean the egg is not perfectly safe to eat/use - just shows you that the egg has definitely been "out of the hen" for probably more than a week. Any egg that smells, however, has actually spoiled, & just like any other spoiled product, should immediately be thrown away. Period.
That aside, the only way to prevent your cooking from becoming contaminated from an egg that is truly rotten is just as others have posted - breaking your eggs into a separate container before adding them to your recipe. And regardless of how your end product ended up tasting, you were (& are) really taking quite a health risk by knowingly consuming a spoiled/rotten egg - cooked through or not. No amount of other ingredients involved would have prevented me from tossing that batch. Yuck.