Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> when malloc() returns NULL? That's a crash - a well-behaved one (no UB involved)

Wrong, dereferencing a NULL pointer is UB.



Which on UNIXes is a crash because the zero page is unmapped so you get a SIGSEGV


Unless the compiler optimized the access away, or replaced it with a different address.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: