upvote
I wouldn’t be sure that a Rust equivalent would be immune because it’s not hard to imagine an underflow/overflow from reaching an unsafe block that’s used for performance (the implicated TLS path would be a hotspot worthy of such a choice).
reply
This is the thing about `unsafe` blocks: they're not memory safe. It's right there in the name.

I'm not making a Rust advocacy argument. I'm just saying: it's true that integer handling issues are endemic to mainstream programming languages, but the integer handling itself is almost never the actual sharp end of the vulnerability.

reply
Isn't "memory corruption" typically the fast path to RCE? The attacker gets to overwrite a function pointer, or a regular pointer that then lets them overwrite something else, or the length field that will then cause a buffer overrun even in a "safe" language because the run-time length is now different than the one in the compile-time check, etc.
reply
Memory corruption -> RCE.

Integer handling mistake -> memory corruption -> RCE.

That's the pattern. In a memory-safe language, the integer handling error has no link to memory corruption (though it will to other logic bugs!).

reply