> However, accessing the 21st byte will not be a segfault. You have to
> access the 8193rd byte to get the OS to say "hey, you don't have
> access to that page, go home."
Or not. Maybe there are 4k pages, or 4M pages. Or maybe the next
page is already mapped into your process from an earlier or later
allocation anyway, and you'd have to step past that. It'll vary by
OS, OS version, architecture, run of program, phase of moon...
> However, accessing the 21st byte will not be a segfault. You have to
> access the 8193rd byte to get the OS to say "hey, you don't have
> access to that page, go home."
Or not. Maybe there are 4k pages, or 4M pages. Or maybe the next
page is already mapped into your process from an earlier or later
allocation anyway, and you'd have to step past that. It'll vary by
OS, OS version, architecture, run of program, phase of moon...
It's hard to define a test of undefined behavior.