3 ms·
"But the first bug is an X.509 logic problem and I don't believe any practical language forecloses on those." I'm likely wrong (this isn't my field), but isn't
by perihelions 6y ago
"But the first bug is an X.509 logic problem and I don't believe any practical language forecloses on those."
I'm likely wrong (this isn't my field), but isn't this particular logic bug avoided by exhaustive enums?
I understand this bug took the form of
(1) a var was assigned an enum type, encoding a logic state ("which X.509 error")
(2) the var gets passed around to different functions, which handle the enum values case-by-case
(3) an update adds a new logic state at (1) (explicit ECC params), but doesn't update the case handling at (2) to handle the new value. Plus, since the error types overwrite each other into the same field, the new error type can clobber an older error type so that they both go unhandled.
If you use strict, exhaustive enums, this type of bug is excluded (isn't it?) The type of the enum will propagate to every place it's read, and the compiler will flag the non-exhaustive case handling in the stale code.
- tptacek 6y agoI don't know about that. Look at the diff, it looks like a counting bug. Rust programs also use counting logic, including in places where you could in theory model with exhaustive enums, but nobody does.