upvote
No. Memory safe languages still have integer handling issues, but the consequences are different. In a memory-unsafe language, integer mishandling often nets out to bad copies and memory corruption.
reply
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
Zig traps arithmetic overflow/underflow when compiling in ReleaseSafe.
reply
X86 had the INTO instruction to trigger a fault if the Overflow flag is set, so not quite a per-instruction bit but more of a suffix. JO is also fairly straightforward for compilers to add on important arithmetic operations. We can probably blame C entirely for this; only in C23 are there intrinsics for overflow detection on arithmetic.
reply
Lisp or Python have a proper numeric tower and don't default to machine types. Keyword being default, fast is still possible in CL.
reply
"I don't know any decent language so let's continue using poorly designed languages". Please look at Swift, Javascript, Python.

Why would CPU designers make a trap if languages do not require it?

reply
JavaScript and Python aren’t systems languages. Swift often pays the performance penalty for trapping everywhere and hasn’t seen adoption as a systems language for that reason.
reply
How does that saying go?

"Go fast and get your things broken into"

reply
We're after a way to go fast without having your things broken into. "Language allows you to specify whether you want wrap around or an exception and hardware makes implementing that efficient" is better than both inefficient runtime checks and silent data corruption.
reply