Bug 5449 - cl_shownet->integer crash the engine sometimes
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: PC Windows Vista
: P3 enhancement
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2012-03-23 11:28 EDT by Gros Bedo
Modified: 2012-12-15 19:25:42 EST
2 users (show)

See Also:



Description Gros Bedo 2012-03-23 11:28:42 EDT
In msg.c, there are a few accesses (3 in total) to cl_shownet->integer without prior checking, which can sometimes make the engine crash. There should be a prior check for cl_shownet existence.

Eg: if ( cl_shownet->integer >= 2 || cl_shownet->integer == -1 ) {

Should be:
if ( cl_shownet && (cl_shownet->integer >= 2 || cl_shownet->integer == -1) ) {
Comment 1 Thilo Schulz 2012-07-01 10:45:59 EDT
cl_shownet is always set by CL_Init and cannot be unset by the user. I don't see how you can trigger this bug. If you can give me steps to reproduce this, or a backtrace where this actually happens, reopen this bug and i will fix this.
Comment 2 Gros Bedo 2012-07-02 07:03:14 EDT
This happens mainly when you mod the game, that's why I can't provide a simple step-by-step instruction.

BUT if you want an example, this directly happened when I made my patch to implement server-side demos:

https://github.com/lrq3000/openarena_engine_serversidedemos/tree/latest

This patch tries to limit to a minimum the number of direct modifications in the engine (almost all of the added code is separated into a sv_demo.c and sv_demo_ext.c files, while I just added a few hooks into the engine).

That's why I tried to keep the engine as unchanged as I could.

But weirdly, when I didn't change the check I mentionned, the engine would crash (I can't remember exactly how, if I remember well I think it's botchan that crashed).

It's up to you to see if this change is to be considered, but I thought that for just a simple added condition that virtually takes no time at all, it can save the hassle of having a tremendously big crash.
Comment 3 Thilo Schulz 2012-07-02 07:18:09 EDT
Hmm.. are you using the MSG_ReadDelta* functions on the server side for your modification?
Because they are using the cl_shownet cvar.
Comment 4 Gros Bedo 2012-07-02 09:38:10 EDT
Yes indeed, they are needed to replay the demos.

I see your point, do you mean that probably I didn't CL_init before using MSG_Read* ?
Comment 5 Zack Middleton 2012-12-15 19:25:42 EST
Committed changes in r2387.