4 ms·
The unsigned comparisons in this code snippet would work fine as long as the object bounds didn't cross the negative-positive boundary (i.e., zero), which it co
by kentonv 10y ago
The unsigned comparisons in this code snippet would work fine as long as the object bounds didn't cross the negative-positive boundary (i.e., zero), which it couldn't because the C/C++ standards require that zero is not a valid address for any object. So, I don't think there's a problem with the architecture you describe.
(That said, as mentioned elsewhere, we're talking about a debug check in a non-security-sensitive code path...)
- lomnakkus 10y ago> the C/C++ standards require that zero is not a valid address for any object. So, I don't think there's a problem with the architecture you describe. IIRC it's a bit more complicated than that...? Isn't it more along the lines that no object may occupy the NULL/nullptr 'address' and that 0 (literal) in a pointer context must be interpreted as NULL/nullptr? IIRC it doesn't specifically say anything about the address 0x00000000 (add bits to taste).