11 ms·
How many "mature C programs" try to recover in a usable way when malloc() returns NULL? That's a crash - a well-behaved one (no UB involved) hence not one that
by zozbot234 1y ago
How many "mature C programs" try to recover in a usable way when malloc() returns NULL? That's a crash - a well-behaved one (no UB involved) hence not one that would be sought by most attackers other than a mere denial of service - but still a crash.
- okanat 1y agoOn 64-bit systems (esp Linux ones) malloc almost never returns NULL but keeps overallocating (aka overcommiting). You don't get out of memory errors / kills until you access it.
- sibellavia 1y agoExactly. Also, it is extremely rare.
- 1718627440 1y ago> when malloc() returns NULL? That's a crash - a well-behaved one (no UB involved) Wrong, dereferencing a NULL pointer is UB.
- sph 1y agoWhich on UNIXes is a crash because the zero page is unmapped so you get a SIGSEGV
- 1718627440 1y agoUnless the compiler optimized the access away, or replaced it with a different address.