Re:Cap'n'Proto remote vuln: pointer overflow check optimized...
by kentonv on Friday April 21, 2017 @02:35PM
(#14168092)
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...)
Re:Cap'n'Proto remote vuln: pointer overflow check optimized...
by lomnakkus on Saturday April 22, 2017 @02:11PM
(#14173812)
> 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).
The compiler for such a machine does not even have to be evil.