ED_LoadFromFile ie Needle in the Haystack

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

ED_LoadFromFile ie Needle in the Haystack

Post by r00k »

So, I'm getting a crash on only two maps, one being jrdm2 "Foot Massage".

It spits out a "ED_LoadFromFile: found %s when expecting {", although running through the debugger i get no error, yet running the /debug/glQrack.exe from there i do.

Is there a particular place i should be double checking, if com_token is getting stomped on? Or an easier way to find this bug other than diff'ing 100 lines of code?

It seems this bug crept in way back into v1.90 from 2011, with the last non bugged version at 1.85, which i cant even run on windows 10 :(
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: ED_LoadFromFile ie Needle in the Haystack

Post by Spike »

make sure you're not triggering a stack overflow or anything.
(try setting msvc's c/c++->code generation->basic type checks to both, or run it in valgrind, or both)

by using an over-long field name, a map could get a nice stack overflow exploit. com_parse can also overflow com_token, which would give a nice large block of memory at a known location... it'd be pretty easy, if you know your asm well enough to avoid nulls.

Print out the stuff you've parsed so far (pipe the output of your engine through cat or to a file and you should be able to see any stdout printed via con_printf->sys_printf->printf even in windows). check which part of the file it reached and if that part of the file has any weird chars or over-long tokens or anything weird like that.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: ED_LoadFromFile ie Needle in the Haystack

Post by r00k »

Thanks for the quick reply and insight.
Its been many moons since i've done any work on the engine and as a hobbiest code monkey i hate leaving bugs unattended :o
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: ED_LoadFromFile ie Needle in the Haystack

Post by r00k »

ya i did a con_printf and after each {...} there was some wonky chars, i assume were comments or some junk from the compiler of that time.
i just added

Code: Select all

		if (com_token[0] != '{')
		{
			com_token[0] = 0;
		//	Host_Error ("ED_LoadFromFile: found %s when expecting {",com_token);
		}
and the map loads now.
is there any side effect of doing this??
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: ED_LoadFromFile ie Needle in the Haystack

Post by r00k »

edit:
wait somehow i ran the =wrong exe, that didnt help.



side note: this forum has no edit button.
i guess we are engraving into marble...
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: ED_LoadFromFile ie Needle in the Haystack

Post by r00k »

hmm man coding after 2am and 2many beers

i guess this works,

Code: Select all

		if (com_token[0] != '{')
		{
			com_token[0] = 0;			
			continue;
		}
dunno dont care, hehe!
Post Reply