Fixes #519
==13884==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000b3d954 at pc 0x0000008ba469 bp 0x7ffd7c8f9ab0 sp 0x7ffd7c8f9aa0
READ of size 4 at 0x607000b3d954 thread T0
#0 0x8ba468 in PlayerController::isTalkingOnPayphone() const /home/maarten/programming/openrw/rwengine/src/ai/PlayerController.cpp:315
#1 0xa148eb in CharacterObject::updateMovementAnimation(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:128
#2 0xa185d9 in CharacterObject::updateCharacter(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:356
#3 0xa17735 in CharacterObject::tick(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:297
#4 0x7c7731 in RWGame::tick(float) /home/maarten/programming/openrw/rwgame/RWGame.cpp:541
#5 0x7c6abb in RWGame::run() /home/maarten/programming/openrw/rwgame/RWGame.cpp:447
#6 0x793b45 in main /home/maarten/programming/openrw/rwgame/main.cpp:17
#7 0x7f154c17e18a in __libc_start_main (/lib64/libc.so.6+0x2318a)
#8 0x793839 in _start (/home/maarten/programming/openrw/build/build/rwgame/rwgame+0x793839)
Fixes this warning:
/home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:202:54: runtime error: downcast of address 0x00000ae11d00 which does not point to an object of type 'PlayerController'
0x00000ae11d00: note: object is of type 'DefaultAIController'
00 00 00 00 58 91 ca 00 00 00 00 00 e0 2e 90 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'DefaultAIController'
/home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:202:75: runtime error: member call on address 0x00000ae11d00 which does not point to an object of type 'PlayerController'
0x00000ae11d00: note: object is of type 'DefaultAIController'
00 00 00 00 58 91 ca 00 00 00 00 00 e0 2e 90 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'DefaultAIController'
/home/maarten/programming/openrw/rwengine/src/ai/PlayerController.hpp:66:16: runtime error: member access within address 0x00000ae11d00 which does not point to an object of type 'PlayerController'
0x00000ae11d00: note: object is of type 'DefaultAIController'
00 00 00 00 58 91 ca 00 00 00 00 00 e0 2e 90 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'DefaultAIController'
Leak sanitizer - tracks leaks.
Address sanitizer - like above and
prohibiteted operations on memory.
Thread sanitizer - tracks data races.
Undefined behaviour - like name says. ;)