We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The client crashes (only with ASAN) when an invalid map (3.map.zip) is loaded. Such a map can be delivered to the client by a malicious server.
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
Run and connect to a server that delivers an invalid map:
./teeworlds "connect 127.0.0.1" "gfx_fullscreen 0" "gfx_screen_height 240" "gfx_screen_width 360" [...] ================================================================= ==31394==ERROR: AddressSanitizer: heap-use-after-free on address 0x61f00012e6e4 at pc 0x5555559764d5 bp 0x7ffffffd8c30 sp 0x7ffffffd8c20 READ of size 4 at 0x61f00012e6e4 thread T0 #0 0x5555559764d4 in CDataFileReader::GetItem(int, int*, int*) /home/osboxes/teeworlds/teeworlds-asan/src/engine/shared/datafile.cpp:406 #1 0x5555559764d4 in CDataFileReader::FindItem(int, int) /home/osboxes/teeworlds/teeworlds-asan/src/engine/shared/datafile.cpp:438 #2 0x555555995f73 in CMap::Load(char const*, IStorage*) /home/osboxes/teeworlds/teeworlds-asan/src/engine/shared/map.cpp:37 #3 0x5555555f0c6f in CClient::LoadMap(char const*, char const*, SHA256_DIGEST const*, unsigned int) /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:807 #4 0x5555555f8408 in CClient::ProcessServerPacket(CNetChunk*) /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:1251 #5 0x5555555f997e in CClient::PumpNetwork() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:1596 #6 0x5555555f9d46 in CClient::Update() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:1766 #7 0x5555555fc9a0 in CClient::Run() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:2108 #8 0x5555555d24e5 in main /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:2704 #9 0x7ffff68e10b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) #10 0x5555555dc48d in _start (/home/osboxes/teeworlds/teeworlds-asan/build/teeworlds+0x8848d) 0x61f00012e6e4 is located 2148 bytes inside of 3072-byte region [0x61f00012de80,0x61f00012ea80) freed by thread T2 here: #0 0x7ffff76918df in operator delete(void*) (/lib/x86_64-linux-gnu/libasan.so.5+0x1108df) #1 0x7fffebe0f000 (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x1423000) previously allocated by thread T2 here: #0 0x7ffff7690947 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0x10f947) #1 0x7fffebe11b41 (/lib/x86_64-linux-gnu/libLLVM-10.so.1+0x1425b41) Thread T2 created by T0 here: #0 0x7ffff75bb805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805) #1 0x5555559cc6f6 in thread_init /home/osboxes/teeworlds/teeworlds-asan/src/base/system.c:484 #2 0x5555555e224f in CGraphicsBackend_Threaded::StartProcessor(CGraphicsBackend_Threaded::ICommandProcessor*) /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/backend_sdl.cpp:56 #3 0x5555555e224f in CGraphicsBackend_SDL_OpenGL::Init(char const*, int*, int*, int*, int*, int*, int, int, int*, int*) /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/backend_sdl.cpp:735 #4 0x55555561719f in CGraphics_Threaded::IssueInit() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/graphics_threaded.cpp:753 #5 0x555555617316 in CGraphics_Threaded::InitWindow() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/graphics_threaded.cpp:760 #6 0x555555617dab in CGraphics_Threaded::Init() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/graphics_threaded.cpp:807 #7 0x5555555fb64d in CClient::Run() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:1951 #8 0x5555555d24e5 in main /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:2704 #9 0x7ffff68e10b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) SUMMARY: AddressSanitizer: heap-use-after-free /home/osboxes/teeworlds/teeworlds-asan/src/engine/shared/datafile.cpp:406 in CDataFileReader::GetItem(int, int*, int*) Shadow bytes around the buggy address: 0x0c3e8001dc80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dc90: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dca0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dcb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dcc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd =>0x0c3e8001dcd0: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd fd 0x0c3e8001dce0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dcf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dd00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dd10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c3e8001dd20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 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 ==31394==ABORTING
Doesn't crash without ASAN.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
The client crashes (only with ASAN) when an invalid map (3.map.zip) is loaded. Such a map can be delivered to the client by a malicious server.
Tested on Ubuntu 20.04 x86_64, Teeworlds version: f35da54b6f2c5f9fd4bbd4559f887ccf8f8cc526
Compilation with ASAN:
Run and connect to a server that delivers an invalid map:
Doesn't crash without ASAN.
The text was updated successfully, but these errors were encountered: