logoalt Hacker News

windwardyesterday at 2:20 PM1 replyview on HN

Pointer arithmetic that could overflow would probably involve a heap and therefore be less likely to require a relative, negative offset. Just use the addresses and errors you get from allocation.


Replies

poly2ityesterday at 4:39 PM

Yes, but there are definitely cases where this doesn't apply, for example when deriving an offset from a user pointer. As such this is not a universal solution.