That's only true for signed integers, overflow is defined as wrapping for unsigned integers.
And even with signed integers the compilers handle it way worse than wrapping: When LLVM finds a overflow that will always happen, it won't report it (Only Clang will do that, but that's before any optimisations and thus can see far less) and optimize it to a `undef` value. The backend subsequently will treat the `undef` value like it's in all registers. If you make a function call with an `undef` value you will pass what's in the register used according to the calling convention before. This can be a pointer that will be leaking info about ASLR or a register that can contain user controlled information.
As an example compile this with optimisations (should work the same with signed integer overflow):
#include <stdio.h>
int main(int argc, char ** argv) {
int a = 1;
int b = 0;
printf("%d", a/b);
}
This prints some ASLR-protected pointer which you can use to calculate the offset, which allows you to break ASLR.
I haven't seen this attack mentioned before and it's probably extremely unlikely to happen in the wild, but it's possible.I also found the article lacking because it doesn't talk about saturation arithmetics: https://en.wikipedia.org/wiki/Saturation_arithmetic Rust offers some functions for it and it can often be less problematic than wrapping, for instance when dealing with the length of things.