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.

Bug Reports / reading long strings from files causes crash

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Feb 2011 20:28
While testing my xml parser, came across an issue. I've attached an example file and snippet. The file has a single line of text, but it's 21k characters long. I can open the file fine, but attempting to READ STRING causes the program to crash.



When testing the same example in GLBasic, the single line actually gets broken up (internally) into several lines to cope with the long line length. So I'm wondering if this is just a system limitation or what? Either way, there should be some kind of failsafe to prevent the crash.

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein

Attachments

Login to view attachments
Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 16th Feb 2011 12:55 Edited at: 16th Feb 2011 13:02
hi,

same issue for me.
(But I use the Matrix1Utils plugins collection to open my texts files and i have no problem, CODE :
even to open your file.)

@+

AMD Athlon(tm)XP 3200+ (2.2GHz) / DDR pc3200 (3x1024Mo) / Nvidia 6800GT (driver 197.45 WHQL)/ XP Pro SP3 / DirectX 9.0c (February 2010)/ DBClassic v1.2 / DBPro v7.4
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Feb 2011 22:11
@Phaelax,
Which version of DBPro is it you are using - I ask because I thought I'd fixed that.

@Silverman,
If you are using my plug-ins, then you should probably use my replacement file commands for file IO.

Also, peeking a string like that from a memblock is unsafe. The peek will read until it hits a null byte, which probably won't occur within the memblock, and may not occur in any allocated memory - if you run into memory you haven't allocated, the program will crash out.

At the very least, you should use the PEEK STRING function with the length parameter and specify the memblock size.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Feb 2011 07:06
I believe it's 7.4, I'll try upgrading and check back.

"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: 17th Feb 2011 19:41
Updated to 7.6 and the above example works fine. My bad!

"Only the educated are free" ~Epictetus
"Imagination is more important than knowledge..." ~Einstein

Login to post a reply

Server time is: 2024-04-24 20:04:31
Your offset time is: 2024-04-24 20:04:31