Skip to content
New issue

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

Segmentation fault (read) while loading map in CRenderTools::RenderEvalEnvelope, render_map.cpp:148 #2979

Open
mmmds opened this issue Oct 23, 2021 · 0 comments · May be fixed by #2931
Open

Comments

@mmmds
Copy link

mmmds commented Oct 23, 2021

The client crashes when an invalid map (12.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"
[...]
AddressSanitizer:DEADLYSIGNAL
=================================================================
==33664==ERROR: AddressSanitizer: SEGV on unknown address 0x613858d99a28 (pc 0x5555558509b3 bp 0x7fffffffb0e0 sp 0x7fffffffae30 T0)
==33664==The signal is caused by a READ memory access.
    #0 0x5555558509b2 in CRenderTools::RenderEvalEnvelope(CEnvPoint*, int, int, float, float*) /home/osboxes/teeworlds/teeworlds-asan/src/game/client/render_map.cpp:148
    #1 0x5555556f5f50 in CMapLayers::EnvelopeEval(float, int, float*, void*) /home/osboxes/teeworlds/teeworlds-asan/src/game/client/components/maplayers.cpp:245
    #2 0x5555558532cf in CRenderTools::RenderQuads(CQuad*, int, int, void (*)(float, int, float*, void*), void*) /home/osboxes/teeworlds/teeworlds-asan/src/game/client/render_map.cpp:240
    #3 0x5555556f75f1 in CMapLayers::OnRender() /home/osboxes/teeworlds/teeworlds-asan/src/game/client/components/maplayers.cpp:375
    #4 0x555555827989 in CGameClient::OnRender() /home/osboxes/teeworlds/teeworlds-asan/src/game/client/gameclient.cpp:611
    #5 0x5555555fce4e in CClient::Render() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:796
    #6 0x5555555fce4e in CClient::Run() /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:2131
    #7 0x5555555d24e5 in main /home/osboxes/teeworlds/teeworlds-asan/src/engine/client/client.cpp:2704
    #8 0x7ffff68e10b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #9 0x5555555dc48d in _start (/home/osboxes/teeworlds/teeworlds-asan/build/teeworlds+0x8848d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/osboxes/teeworlds/teeworlds-asan/src/game/client/render_map.cpp:148 in CRenderTools::RenderEvalEnvelope(CEnvPoint*, int, int, float, float*)
==33664==ABORTING

Compilation without ASAN:

export CXXFLAGS="-ggdb -O0"
export CFLAGS="-ggdb -O0"
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"
[...]
Segmentation fault (core dumped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants