News for hackers. Stuff that matters.
Re:Linux: Vulnerabilities in nf_tables cause privilege escal... by throwaway81523 on Tuesday March 29, 2022 @07:50PM (#30849849)
Saturating on overflow as bad as the 2s complement wraparound on unsigned if you were not expecting/relying on it. C lacks a type where unsigned overflow is an error or UB. Having it UB is acceptable because then you can choose a compiler option (-ftrapv) that traps it. But, I have heard this is unreliable, e.g. what happens if the overflow happens in library code?

Ada does this correctly, and lets you choose between exception and wraparound. UB is not an option in the language spec, though you can turn off the checks as an optimization option in GNAT, or maybe turn it off at specific lines of code with a pragma.

There are no comments on this comment yet.