ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
asan.c File Reference

AddressSanitizer error reporting integration with logging system. More...

Go to the source code of this file.

Detailed Description

AddressSanitizer error reporting integration with logging system.

Integrates ASan error reports into the ascii-chat logging system so that memory errors are captured in log files and respect –grep filtering, rather than spamming stderr and corrupting terminal rendering.

Uses __asan_set_error_report_callback() to intercept ASan reports before they hit stderr. Reports are fed through log_fatal() which respects:

  • –log-file (writes to file instead of stdout/stderr)
  • –grep (filters error messages)
  • Proper formatting without terminal corruption

CONSTRUCTOR TIMING: The attribute((constructor)) runs before main(), ensuring ASan reports are captured from the very first allocation.

SAFETY: The callback is intentionally minimal to avoid deadlocks. ASan calls this callback when memory is corrupted, so:

  • No mutex locks (deadlock risk)
  • No complex operations
  • Just pass the report string to logging

The actual logging (log_fatal) may be called in an unsafe state, but at that point the process is about to abort anyway, so best effort is fine.

Definition in file asan.c.