From 5a9d93f160f5685e9ee9e5732135f466b9625915 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Nov 2020 23:06:44 +0100 Subject: [PATCH] Initialize pointer in dragger How did this not blow up all day long for years?! Found by UBSAN: /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:32:29: runtime error: member call on address 0x0000013319b8 which does not point to an object of type 'CCharacter' 0x0000013319b8: note: object has invalid vptr 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ invalid vptr #0 0x5501de in CDragger::Move() /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:32:29 #1 0x5522c2 in CDragger::Tick() /home/teeworlds/src/master/src/game/server/entities/dragger.cpp:153:3 #2 0x5eb11e in CGameWorld::Tick() /home/teeworlds/src/master/src/game/server/gameworld.cpp:261:11 #3 0x58d660 in CGameContext::OnTick() /home/teeworlds/src/master/src/game/server/gamecontext.cpp:751:10 #4 0x4afefe in CServer::Run() /home/teeworlds/src/master/src/engine/server/server.cpp:2558:19 #5 0x4c26fd in main /home/teeworlds/src/master/src/engine/server/server.cpp:3551:21 #6 0x7f2c8cc9309a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #7 0x451509 in _start (/home/teeworlds/servers/DDNet-Server-ubsan+0x451509) --- src/game/server/entities/dragger.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/server/entities/dragger.cpp b/src/game/server/entities/dragger.cpp index 6149d7514..c0db76f5f 100644 --- a/src/game/server/entities/dragger.cpp +++ b/src/game/server/entities/dragger.cpp @@ -12,6 +12,7 @@ CDragger::CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW, int CaughtTeam, int Layer, int Number) : CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER) { + m_Target = 0; m_Layer = Layer; m_Number = Number; m_Pos = Pos;