ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.76k stars 2k forks source link

Fix segfault in NDebugOverlay::Circle when debugoverlay is nullptr #367

Open sigsegv-mvm opened 8 years ago

sigsegv-mvm commented 8 years ago

The debugoverlay interface global is initialized to nullptr in the dedicated server. All of the NDebugOverlay functions which call into debugoverlay make sure to check whether it's nullptr before calling, with the exception of NDebugOverlay::Circle, which does no such check.

This means that enabling certain debug convars on a dedicated server can cause the server to crash instead of just doing nothing (anything that tries to draw circles has this problem, e.g. nb_debug LOOK_AT).

It can be desirable to enable some debug convars on a dedicated server purely for the text output, but this becomes infeasible if the same debug convar also tries to draw circle overlays, crashing everything.

This patch adds a nullptr check to NDebugOverlay::Circle to fix the problem.