Forum

saved game bug :(

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

saved game bug :(

Postby r00k » Thu Jul 10, 2014 6:02 pm

So somewhere when adding protocol 666 i cant save games. Funny i added 666 1 1/2 year ago no one ever found it.

Code: Select all
   case ev_string:
      sprintf (line, "%s", pr_strings + val->string);
      break;


Access violation.

Any idea where i should look? I've started from the save command up to the line above where it crashes and there are no code changes in those specific functions.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Re: saved game bug :(

Postby revelator » Thu Jul 10, 2014 9:15 pm

hmm i wonder if using _snprintf instead would help :?:
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: saved game bug :(

Postby Spike » Thu Jul 10, 2014 11:42 pm

which key/field/global is it saving?

strings are often dodgy. especially in 64bit builds. negative values are not unheard of. which is vile.
remember that the engine typically uses val->string = "somestring"-pr_strings; to set the string. the string value can point to ANY bit of memory (within a 32bit memory space), which can have been freed or whatever since it was allocated.
or the mod you're running somehow messed up some argument or something and stored a float in a string field, which is a common way to crash an engine...
making an engine 64-bit safe is fun, and typically fixes all these other issues in the process, if done properly.

sprintf won't crash on that line due to an overflow, the crash would be on one of the following lines instead. snprintf would be a good idea though. or strlcpy.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: saved game bug :(

Postby r00k » Fri Jul 11, 2014 2:16 pm

Well, so far I have tracked the bug back to Nov. 2012, so I'm sure it's not the protocol 666 implementation as I didnt have it in that version... :D
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Re: saved game bug :(

Postby r00k » Mon Jul 14, 2014 4:51 pm

Okay so, i found the bug....

or the mod you're running somehow messed up some argument or something and stored a float in a string field, which is a common way to crash an engine...


seems to be the sv_cullentities code..... :( not sure why.... unless the edict is on the list, but when culled the values are 0... :/
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest