3 ms·
When using GCC for example, there’s a macro one can define which adds bounds checking to all containers. Integer overflow can be turned into defined behavior t
by blub 4y ago
When using GCC for example, there’s a macro one can define which adds bounds checking to all containers.
Integer overflow can be turned into defined behavior through a compiler switch.
Holding pointers to stack variables past the return is not as easy to inadvertently do as an off-by-one. Someone has to store the address into a variable and this kind of code should raise alarm bells.
A more indirect way is to pass an address of a local variable to a function which is typical. But then if a function takes arbitrary pointers it receives and stores them, this should also raise some alarm bells.