Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / help tracking down a bug

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2011 03:18 Edited at: 10th Jan 2011 20:31
Resolved

There seems to be a bug in my XML library. Something in the xmlReadFile() function crashes the application and seems to be Windows 7(64-bit) specific. The same code runs fine in XP and only crashes for me on Win7.

The crash happens during the last line of the file. For instance, if my XML document has 52 lines, it'll process the first 51 lines within the while loop just fine. After it reads the last line of the file, something causes it to crash while that string is being processed.

I think it might have something to do with the stack, but I'm not sure.



Download sample XML file

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 10th Jan 2011 11:22 Edited at: 10th Jan 2011 11:24
Well...I put in lots of debug code


If I comment out line 98(in my debug version) it works,
so this line or the routine it calls is causing the problem

Sorry I need to get some sleep, good luck.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2011 19:00 Edited at: 10th Jan 2011 19:02
I've further tracked the issue to the following line in the xmlGetAttributeValue$() function:

i = pGetIndexOf(xmlTags(elementId).unparsedAttributes, attName$)

If I comment that out, it'll run. Thanks for the help Bill, hopefully I'll have this resolved shortly.

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2011 19:50
Ok, I've found the culprit, although I'm even more perplexed now.

Inside the xmlGetAttributeValue() function, I have a simple check that'll exit the function early if the attribute is not found.

if i = -1 then exitfunction ""

Comment that line out and it works. Removing that line does not prevent the code from working as it should, however it's there for efficiency purposes.

If I rearrange attValue$ = "" to be above this check and then return this value instead of explicitly returning an empty string, the code works fine. I think at this point I'm going to mention this in the bug reports board.

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Jan 2011 19:57
I'm fairly sure that's already been done.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2011 20:03 Edited at: 10th Jan 2011 20:10
You're saying someone's already mentioned this bug? Or that it's been fixed?

Ok, yea it looks like Fallout brought this up last year and it's been confirmed.

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 12th Jan 2011 10:30
Because of the static string return from a function bug...
Just change
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 12th Jan 2011 14:22
If you have a static string on an ENDFUNCTION line, then you do need to change it to a variable.

For EXITFUNCTION though, you another alternative - turn it into an expression instead:


That works in other situations too when you get an error telling you that the EXITFUNCTION return type doesn't match the ENDFUNCTION return type.

Login to post a reply

Server time is: 2024-05-05 18:48:21
Your offset time is: 2024-05-05 18:48:21