You can provide a signal handler for SIGSEGV although catching it has a very limited use and you have to know what you are doing.