You're probably trying access memory which your program isn't allowed to access and "crash" is just system preventing "virus" (you :) ) from destroying it.
Here's a little linux code compiled with gcc:
#include <stdio.h>
int b;
int main() {
char *ptr = (char*)&b;
ptr -= 2368;
int i;
for( i = 0; i < 3984; i++){
printf( "%d: %c\n", i, ptr[i]);
}
printf( "\n");
return 0;
}
If you try to access -2369
bytes you'll get segmentation fault (access violation). If you try to access more than 3984th byte (3983th including "zero byte") you'll get the same error (this is probably page size usable for application use).
You can also access binary code directly:
char *ptr = (char*)&main;
ptr -= 999;
int i;
for( i = 0; i < 3763; i++){
printf( "%c", ptr[i]);
}
On my system is address of b: 0x600970
And address of main: 0x4004e4
So you can see you have access to different scopes of memory, but you're limited just to those.