Forum

ED_LoadFromFile ie Needle in the Haystack

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

Moderator: InsideQC Admins

ED_LoadFromFile ie Needle in the Haystack

Postby r00k » Tue Sep 22, 2015 4:02 pm

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

Re: ED_LoadFromFile ie Needle in the Haystack

Postby Spike » Tue Sep 22, 2015 5:35 pm

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.
Spike
 
Posts: 2883
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: ED_LoadFromFile ie Needle in the Haystack

Postby r00k » Wed Sep 23, 2015 1:47 am

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

Re: ED_LoadFromFile ie Needle in the Haystack

Postby r00k » Thu Sep 24, 2015 6:48 am

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

Re: ED_LoadFromFile ie Needle in the Haystack

Postby r00k » Thu Sep 24, 2015 6:59 am

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

Re: ED_LoadFromFile ie Needle in the Haystack

Postby r00k » Thu Sep 24, 2015 7:08 am

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!
r00k
 
Posts: 1108
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