Inside [TS-5] Debug/error Callback Pointer + Cookie

by Jule 52 views
Inside [TS-5] Debug/error Callback Pointer + Cookie

In the quiet corner of log code where ln_dbgprintf checks for a valid callback before invoking it, a deadly race unfolds. If a thread clears the callback or cookie between validation and execution, a NULL pointer error slips through - crushing stability. The bug, visible at line 63 in src/lognorm.c, exposes a hidden thread-safety flaw in how callbacks and cookies are managed. This isn’t just a crash - it’s a pattern seen in high-stakes logging systems, where timing glitches expose sensitive data or freeze apps. The same issue plagues `ln_errprintf