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 / read string causes exception

Author
Message
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 1st Sep 2008 23:31
If you try to use 'read string' when the line in the file has more than a certain number of characters, the program crashes with a an exception.
I would imagine that this is because DBPro allocates a fixed size buffer before calling whatever function it uses to read the string from the file.

There is no error given by DBPro, just an unhandled exception, so if this is not fixed, at least handle the exception!


To reproduce the problem, just write a very long line into notepad, and save it and use read string on it.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 2nd Sep 2008 00:38
Already a confirmed bug, 2 years old and still not fixed;

http://forum.thegamecreators.com/?m=forum_view&t=81894&b=15

Boo!
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Sep 2008 14:31
If you provide a code snippet so it can be copied, pasted, compiled and verified, it can be marked as Confirmed.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 5th Sep 2008 19:23 Edited at: 5th Sep 2008 19:24


There seems to be a maximum of 1330 characters, so any more will crash it.
(for a moment I thought it was going to turn out to be 1337 characters max)

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
calcyman
18
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 23rd Sep 2008 18:09
[Confirmed]

On my computer 1331 characters says "Created" and "Loaded".

However, it does fail for 1332 characters.
Presumably it collides into existing memory locations, and it happens that the 1332nd memory location from the start causes a crash when corrupted.

You can get around this problem if you continually read bytes until you reach a carriage return, and add those bytes to a string.

The optomist's right, The pessimist's right.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Sep 2008 13:30
Quote: "[Confirmed]

On my computer 1331 characters says "Created" and "Loaded".

However, it does fail for 1332 characters."


Same here.

Perhaps this hasn't been confirmed because Diggsey's code works on BatVink's machine?

This really ought to be confirmed.
pcRaider
19
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 25th Sep 2008 14:47 Edited at: 25th Sep 2008 14:50
I inspected it.
This becomes a Windows error.
I confirmed it in DBP ver1070b4.

test1


test2
calcyman
18
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 29th Sep 2008 18:43
It's very easy to get around this problem:



The optomist's right, The pessimist's right.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th Sep 2008 18:55
Just because you can get around it does not mean it should not be fixed.
Also, there are a number of things wrong with that code (although they could be fixed easily)
- It will crash if the last string is not terminated with a carriage return
- All returned strings will end with the line-feed character

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
calcyman
18
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 29th Sep 2008 22:22
Alright then:



Now it won't crash. And the write string documentation says it terminates a string with a carriage return.

The optomist's right, The pessimist's right.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Oct 2008 14:32
Quote: "Perhaps this hasn't been confirmed because Diggsey's code works on BatVink's machine? "


No, I don't confirm bugs, I don't feel particularly qualified. I was just making a helpful suggestion to get it confirmed

As it turns out - it works on my machine so I couldn't confirm it anyway!

Login to post a reply

Server time is: 2026-06-12 05:22:22
Your offset time is: 2026-06-12 05:22:22