Is there a way to check how "far away" a pointer is from a page boundary?

Just because a read past the end of an array crosses a page boundary doesn’t mean that it must crash, just that it may crash. It depends on whether the next page is readable. The fact that reading a few bytes past the end of an array hardly ever crashes just makes the bug more insidious and harder to track down — that’s why tools like efence and valgrind are helpful.

1 Like