|
|
|
|
|
by fsddfsdfssdf
26 days ago
|
|
While I can see the shortcomings of C and generally don't recommend it for new projects I don't see this particular bug as a good example of something Rust's borrow checker or some other language's type system will catch. I don't think even static analyzers can catch this. It's basically something like this: original: DoTheThing() new: DoTheThingSlightlyDifferentButKeepMyCredentialsAlive() fix: DoTheThingSlightlyDifferentButDoInFactNOTKeepMyCredentialsAlive() In my experience a substantial portion of gnarly bugs come down to a violation of a high-level system invariant and those do not strike me as something that can be automated. Even with something like Lean you can prove your program satisfies certain properties but you need to have thought about those properties in the first place. The proof doesn't discover the invariant for you. If you'd had thought about the relevant security property you could have written a regression test for it which is not hard. IMO the really hard part isn't expressing the implementation safely, but it's the realization that this was a property the implementation needed to preserve. |
|