AddressSanitizer (or ASan) is an open source programming tool that detects memory corruption bugs such as buffer overflows or accesses to a dangling pointer (use-after-free). AddressSanitizer is based on compiler instrumentation and directly mapped shadow memory.
YouTube channel Binary Adventures has a series of videos about Address Sanitizer. The first video shows how it works, this is where he starts to explain how a buffer overflow is detected
Compile TrinityCore with -DASAN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
Ensure that a directory called worldasan exists in the bin directory, where worldserver is:
cd <bin directory> # eg: cd ~/wow/bin
mkdir -p worldasan
Start your worldserver with the included environment variables:
ASAN_OPTIONS=halt_on_error=0:verbosity=1:log_path=worldasan/worldasan:detect_stack_use_after_return=1 \
LSAN_OPTIONS=verbosity=1:log_threads=1 ./worldserver
Test the result using .debug asan memoryleak
and .debug asan outofbounds
commands.