News for hackers. Stuff that matters.
Re:Linux: Vulnerabilities in nf_tables cause privilege escal... by Munksgaard on Tuesday March 29, 2022 @02:00AM (#30839300)
Rust does in fact have a story around overflows: https://doc.rust-lang.org/book/ch03-02-data-types.html#integ...
Re:Linux: Vulnerabilities in nf_tables cause privilege escal... by StillBored on Tuesday March 29, 2022 @02:18AM (#30839420)
But the rust story is basically the same as the C story, which is use something other than the normal operators to do your arithmetic.

There are tons of checked_add()_sub/_mul macros or functions floating around. At least in C++ one could override the global operators if needed.

Re:Linux: Vulnerabilities in nf_tables cause privilege escal... by fbkr on Tuesday March 29, 2022 @03:19AM (#30839745)
You cannot overload operators of integral types in C++, if you mean you can overload `int operator+(int, int)` to be saturating. You can create `saturating_int` kind of types easily though.
Re:Linux: Vulnerabilities in nf_tables cause privilege escal... by pjmlp on Tuesday March 29, 2022 @04:41AM (#30840230)
Despite its C underpinnings, C++ does provide the tooling for Type Driven Development like ML languages, I think it is a hard sell on the performance driven culture to have little types for those purposes, which is why it isn't used as much as it should.
Re:Linux: Vulnerabilities in nf_tables cause privilege escal... by steveklabnik on Tuesday March 29, 2022 @09:23AM (#30842212)
You can also pass a flag to have all overflows checked, if desired. We do, even on embedded where space is a premium. We’ll take the performance hit.