saved game bug :(

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

saved game bug :(

Post by r00k »

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.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: saved game bug :(

Post by revelator »

hmm i wonder if using _snprintf instead would help :?:
Productivity is a state of mind.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: saved game bug :(

Post by Spike »

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.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: saved game bug :(

Post by r00k »

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: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: saved game bug :(

Post by r00k »

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... :/
Post Reply