News for hackers. Stuff that matters.
Re:What is your favorite C programming trick? (2009) by Quekid5 on Sunday November 22, 2020 @05:36PM (#25181772)
Indeed, it shouldn't be a first line of defense (nulling + an assert seems reasonable, fwiw), and accessing a nulled out pointer is just as UB as any other UB. It's probably more likely to crash immediately in practice, but it's also easier for an optimizer to "see through", so you may get surprising optimizations if you get it wrong.

Honestly, unless you really cannot afford it time-budget wise, I would just ship everything with ASAN, UBSAN, etc. and deal with the crash reports.

Re:What is your favorite C programming trick? (2009) by saagarjha on Monday November 23, 2020 @03:27AM (#25184676)
Shipping code with Address Sanitizer enabled is generally not advisable; it has fairly high overhead. You should absolutely use it during testing, though!
Re:What is your favorite C programming trick? (2009) by Quekid5 on Friday November 27, 2020 @03:15PM (#25232210)
That's why I added the "afford it" bit.