<div dir="ltr"><div class="gmail_extra">After you get a SIGSEGV, you are screwed. You can probably recover if you do a lot of work, but overall it's not worth it. Also in a signal handler you are not guaranteed malloc() will work, the kernel may not allow you to allocate more memory. Also your signal handler for SIGSEGV will keep getting called because the SIGSEGV keeps coming until the program exits. Note that you are not recommended to use functions such as printf() in a signal handler (see: <a href="https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers">https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers</a> ). </div>
<div class="gmail_extra"><br></div><div class="gmail_extra">It might be worth looking into things like libsigsegv: <a href="http://libsigsegv.sourceforge.net/">http://libsigsegv.sourceforge.net/</a></div><div class="gmail_extra">
<br></div><div class="gmail_extra">I hope this can help!</div></div>