Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (EternallyCurious, howardR), 646 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
file_str_read crashes with '#' character #420034
03/18/13 20:03
03/18/13 20:03
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline OP
Expert
Uhrwerk  Offline OP
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Hello jcl,

file_str_read produces a crash if the very first character in a file is '#'. Here are the steps necessary to reproduce the problem. First create a file test.txt with content like this:
Code:
#123456789

If you then execute the following snippet the engine will crash.
Code:
#include <acknex.h>

void main()
{
	var h = file_open_read("test.txt");
	if (h)
	{
		STRING* s = str_create("#128");
		file_str_read(h,s);
		printf("The content is:\n%s\nThe length is:\n%d",s->chars,(int)str_len(s));
		file_close(h);
	}
}

Best regards,
Uhrwerk


Always learn from history, to be sure you make the same mistakes again...
Re: file_str_read crashes with '#' character [Re: Uhrwerk] #420049
03/19/13 07:42
03/19/13 07:42
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Thanks! This will be fixed.

Re: file_str_read crashes with '#' character [Re: Uhrwerk] #420070
03/19/13 12:09
03/19/13 12:09
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
Originally Posted By: Uhrwerk
Hello jcl,

file_str_read produces a crash if the very first character in a file is '#'. Here are the steps necessary to reproduce the problem. First create a file test.txt with content like this:
Code:
#123456789

If you then execute the following snippet the engine will crash.
Code:
#include <acknex.h>

void main()
{
	var h = file_open_read("test.txt");
	if (h)
	{
		STRING* s = str_create("#128");
		file_str_read(h,s);
		printf("The content is:\n%s\nThe length is:\n%d",s->chars,(int)str_len(s));
		file_close(h);
	}
}

Best regards,
Uhrwerk


the problem is not in file_str_read but in printf

Re: file_str_read crashes with '#' character [Re: Dico] #420077
03/19/13 14:04
03/19/13 14:04
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted By: Dico
the problem is not in file_str_read but in printf
Use any other draw function f.e. debug_var or draw_text, and you'll see that bug is still there wink


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: file_str_read crashes with '#' character [Re: 3run] #420083
03/19/13 15:04
03/19/13 15:04
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
Originally Posted By: 3run
Originally Posted By: Dico
the problem is not in file_str_read but in printf
Use any other draw function f.e. debug_var or draw_text, and you'll see that bug is still there wink

but i test it with TEXT and it work nice without any problem .
but when i use printf the engine crash

Re: file_str_read crashes with '#' character [Re: 3run] #420084
03/19/13 15:11
03/19/13 15:11
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
Originally Posted By: 3run
Originally Posted By: Dico
the problem is not in file_str_read but in printf
Use any other draw function f.e. debug_var or draw_text, and you'll see that bug is still there wink


try this

Code:
#include <acknex.h>

STRING* str_show = "";
TEXT* txt_d =
{
	string = str_show;
	pos_y = 200;
	flags = SHOW;
}

void main()
{
	var h = file_open_read("test.txt");
	if (h)
	{
		STRING* s = str_create("#128");
		file_str_read(h,s);
		//printf("The content is:\n%s\nThe length is:\n%d",s->chars,(int)str_len(s));
		str_cpy(str_show,s);
		
		file_close(h);
	}
}


there is no crash

Re: file_str_read crashes with '#' character [Re: Dico] #420087
03/19/13 15:42
03/19/13 15:42
Joined: Feb 2012
Posts: 371
Dico Offline
Senior Member
Dico  Offline
Senior Member

Joined: Feb 2012
Posts: 371
maybe there is another problem !!

Re: file_str_read crashes with '#' character [Re: Dico] #420104
03/19/13 18:23
03/19/13 18:23
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline OP
Expert
Uhrwerk  Offline OP
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
It is correct that your sample does not crash. But it does not set the string read to the correct contents from the file and takes ages to execute. So the bug is clearly related to file_str_read.

Please don't triple post.


Always learn from history, to be sure you make the same mistakes again...
Re: file_str_read crashes with '#' character [Re: Uhrwerk] #420128
03/20/13 10:45
03/20/13 10:45
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
The problem was in file_str_read, but it might not cause a crash on any system.

The "#" was interpreted as in a string definition, so the program allocated a string of the size 123456789 bytes, but a string of this size was not expected, only a string of 11 bytes. Anyway it's fixed now.

Re: file_str_read crashes with '#' character [Re: jcl] #420180
03/20/13 21:42
03/20/13 21:42
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline OP
Expert
Uhrwerk  Offline OP
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Well, on my machine the sample I posted above does crash. Maybe this is of any help to you:
Code:
Source
acknex.exe

Summary
Stopped working

Date
&#8206;3/&#8206;20/&#8206;2013 10:39 PM

Status
Report sent

Description
Faulting Application Path:	D:\Program Files (x86)\GStudio8\acknex.exe

Problem signature
Problem Event Name:	BEX
Application Name:	acknex.exe
Application Version:	0.0.0.0
Application Timestamp:	4c1231af
Fault Module Name:	StackHash_e98d
Fault Module Version:	0.0.0.0
Fault Module Timestamp:	00000000
Exception Offset:	20202020
Exception Code:	c0000005
Exception Data:	00000008
OS Version:	6.1.7601.2.1.0.256.48
Locale ID:	1033
Additional Information 1:	e98d
Additional Information 2:	e98dfca8bcf81bc1740adb135579ad53
Additional Information 3:	6eab
Additional Information 4:	6eabdd9e0dc94904be3b39a1c0583635

Extra information about the problem
Bucket ID:	2589014125



Always learn from history, to be sure you make the same mistakes again...

Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1