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

Unless you were on systems that mapped address 0 to a writable but always zero value so they could do load and store speculation without worry.

IBM did this for a long time



My favourite were older embedded systems where 0 was an address you actually do interact with. So for some portion of the code you WANT null pointer access. I can't remember the details but I do remember jumping to null to reset the system being pretty common.


Probably the system interrupt table. Index 0 might reference the handler for the non-maskable interrupt NMI, often the same as a power-on reset.

I recall that on DOS, Borland Turbo C would detect writes to address 0 and print a message during normal program exit.


RANDOMIZE USR 0


In Wasm you can read/write whatever to address zero of linear memory.

It's still UB as far as clang is concerned so you C code can do whatever. But it won't “crash” on the spot.




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

Search: