2 ms·
Early exits should be used carefully - security critical code should not rely on a single check due to TOCTOU errors. Essentially every check hit after the prim
by AstralStorm 7y ago
Early exits should be used carefully - security critical code should not rely on a single check due to TOCTOU errors. Essentially every check hit after the primary - and there should be such cold redundant checks - is a critical error - not necessarily in "System Halted" way but high severity. These may light up on normal use in concurrent cases too if there are bugs. Even hardware bugs.
Guard macro/template/local assertion is almost always better, the key is to not produce too much distracting syntactic noise or work against language features.
Redundant rare checks are eaten by branch prediction. (Needs care too, call when Spectre is fixed.)