The client crashes (only with ASAN) when it starts using default configuration.
Tested on Ubuntu 20.04 x86_64, Teeworlds version: f35da54b6f2c5f9fd4bbd4559f887ccf8f8cc526
Compilation with ASAN:
export CXXFLAGS="-ggdb -O0 -fsanitize=address -fno-omit-frame-pointer"
export CFLAGS="-ggdb -O0 -fsanitize=address -fno-omit-frame-pointer"
cmake ..
make
Remove default configuration, run the game twice (to generate configuration and then to trigger the bug)
rm -rf ~/.local/share/teeworlds/
./teeworlds
./teeworlds
[...]
=================================================================
==4084==ERROR: AddressSanitizer: heap-use-after-free on address 0x6130000123a0 at pc 0x5602badd13af bp 0x7ffdbba67410 sp 0x7ffdbba67400
READ of size 1 at 0x6130000123a0 thread T0
#0 0x5602badd13ae in CMenus::CBrowserFilter::Switch() /home/osboxes/teeworlds/teeworlds-asan/src/game/client/components/menus_browser.cpp:86
#1 0x5602badd13ae in CMenus::LoadFilters() /home/osboxes/teeworlds/teeworlds-asan/src/game/client/components/menus_browser.cpp:261
#2 0x5602badc9d6c in CMenus::OnInit() /home/osboxes/teeworlds/teeworlds-asan/src/game/client/components/menus.cpp:1173
#3 0x5602baed6f88 in CGameClient::OnInit() /home/osboxes/teeworlds/teeworlds-asan/src/game/client/gameclient.cpp:390
#4 0x5602baca2485 in CClient::Run() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:1997
#5 0x5602bac794e5 in main /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:2704
#6 0x7fadf7bac0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#7 0x5602bac8348d in _start (/home/osboxes/teeworlds/teeworlds-asan/build/teeworlds+0x8848d)
0x6130000123a0 is located 224 bytes inside of 384-byte region [0x6130000122c0,0x613000012440)
freed by thread T0 here:
#0 0x7fadf89597cf in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0x10d7cf)
#1 0x7fadf8488fcf in FT_Outline_Done (/lib/x86_64-linux-gnu/libfreetype.so.6+0x10fcf)
previously allocated by thread T0 here:
#0 0x7fadf8959bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x7fadf848d771 (/lib/x86_64-linux-gnu/libfreetype.so.6+0x15771)
SUMMARY: AddressSanitizer: heap-use-after-free /home/osboxes/teeworlds/teeworlds-asan/src/game/client/components/menus_browser.cpp:86 in CMenus::CBrowserFilter::Switch()
Shadow bytes around the buggy address:
0x0c267fffa420: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c267fffa430: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c267fffa440: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c267fffa450: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
0x0c267fffa460: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c267fffa470: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd
0x0c267fffa480: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
0x0c267fffa490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fffa4a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c267fffa4b0: 00 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fa
0x0c267fffa4c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==4084==ABORTING
The client crashes (only with ASAN) when it starts using default configuration.
Tested on Ubuntu 20.04 x86_64, Teeworlds version: f35da54b6f2c5f9fd4bbd4559f887ccf8f8cc526
Compilation with ASAN:
Remove default configuration, run the game twice (to generate configuration and then to trigger the bug)