News for hackers. Stuff that matters.
Re:Catching integer overflows in C by Mikhail_Edoshin on Wednesday August 22, 2018 @04:01AM (#17817127)
By generically you mean "in C"? Sometimes the functionality is there, but there's no way to express it in C. Integer overflows are exactly such a case; many processors provide a built-in overflow detection mechanism, but there's no way to access it in C. (It's not even a special mechanism, it's just the command itself, in assembly you clearly see the overflow.) I'd say that using compiler-specific functions (provided they plug into these processor commands) or assembly is exactly the right way to deal with this issue. Yes, parts of the code will be non-portable, but if they're clearly isolated and marked as machine-specific, then why not? The pros certainly outweigh the cons.
Re:Catching integer overflows in C by Annatar on Wednesday August 22, 2018 @06:36AM (#17817695)
I had exactly that happen when compiling PowerDNS: the developers relied on a GCC intrinsic, so I had to embark on an epic journey of building and packaging a newer version of GCC.

Just to be able to serve DNS answers.

That’s just so wrong.