upvote
The N >= 0 check you often get automatically using sanitizers, e.g. when using an array [N] somewhere, or by concerting to size_t at last moment and then getting a size which is so big that allocation is guaranteed to fail.

Not that are wraparound CVEs in Rust as well, so there is no perfect solution even outside of C.

reply