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

Crash in game/server/gamecontext.cpp:920 CPlayer::GetTeam() 0x0 segfault #69

Open
ChillerDragon opened this issue Feb 11, 2020 · 1 comment

Comments

@ChillerDragon
Copy link
Contributor

Thread 1 "multimap_srv_d" received signal SIGSEGV, Segmentation fault.
0x00005555555d06d6 in CPlayer::GetTeam (this=0x0) at /opt/twserver/git/ddnet7/src/game/server/player.h:31
31		int GetTeam() const { return m_Team; };
#0  0x00005555555d06d6 in CPlayer::GetTeam (this=0x0) at /opt/twserver/git/ddnet7/src/game/server/player.h:31
#1  0x00005555555e00e4 in CGameContext::OnClientEnter (this=0x7ffff5ab7010, ClientID=7) at /opt/twserver/git/ddnet7/src/game/server/gamecontext.cpp:920
#2  0x00005555555a985e in CServer::ProcessClientPacket (this=0x7ffff62e8010, pPacket=0x7fffffffd8a0) at /opt/twserver/git/ddnet7/src/engine/server/server.cpp:1048
#3  0x00005555555ab212 in CServer::PumpNetwork (this=0x7ffff62e8010) at /opt/twserver/git/ddnet7/src/engine/server/server.cpp:1381
#4  0x00005555555ac23a in CServer::Run (this=0x7ffff62e8010) at /opt/twserver/git/ddnet7/src/engine/server/server.cpp:1619
#5  0x00005555555af75e in main (argc=2, argv=0x7fffffffe4a8) at /opt/twserver/git/ddnet7/src/engine/server/server.cpp:2386
@ChillerDragon
Copy link
Contributor Author

ChillerDragon commented Feb 11, 2020

                null pointer check
                       | 
                       V
if(i == ClientID || !m_apPlayers[i] || (!Server()->ClientIngame(i) && !m_apPlayers[i]->IsDummy()))
	continue;

// new info for others
if(Server()->ClientIngame(i))
	Server()->SendPackMsg(&NewClientInfoMsg, MSGFLAG_VITAL|MSGFLAG_NORECORD, i);

// existing infos for new player
CNetMsg_Sv_ClientInfo ClientInfoMsg;
ClientInfoMsg.m_ClientID = i;
ClientInfoMsg.m_Local = 0;
ClientInfoMsg.m_Team = m_apPlayers[i]->GetTeam();
                                 ^
                                 |
                            null pointer crash

Since there is a continue guarding the existence of m_apPlayers[i] it does not make any sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant