Stream Error BlitzMax Crash without error message

BlitzMax Forums/BlitzMax Programming/Stream Error BlitzMax Crash without error message

Midimaster(Posted 2010) [#1]
I found a strange bug in BlitzMax. The ReadFile() Command crashes. But I had extremly problems to extract this bug from my program, because it is a combination of 5 elements which have to come together.

Here is a code to demonstrate the bug:

Import koriolis.zipstream
SuperStrict

Graphics 300,200
Global Sound:TSound, Text$, Path$, Void$, tmpText$, locText$
Global Stream:TStream

Path="ZIP::tt1.zip//"

Print "Step 1"
tmpText= LoadText(Path + "translation.ini")

Print "Step 2"
Stream=ReadFile(Path + "RockSongA.Lst")

Print "Step 3"
Sound = LoadSound(Path + "crash.ogg")		
While Not Eof(Stream)
	locText= ReadLine(Stream)
Wend

Print "Step 4"		
CloseStream Stream

Print "Reading Stream finished"
WaitKey()
End


You will find the corresponding ZIP-file here:
http://www.blitzforum.de/upload/file.php?id=8658

I can observe, that the program does not reach the point "Reading Stream Ready".

But if you commend out one of the lines:

tmpText=LoadText...
or...
Sound=LoadSound...
...it will run.

The problems appears since I added the Translation.Ini into the ZIP-file. The Translation.Ini is a Unicode-conform text. You also can use a UTF8 or UTF16. The problem is the same.

The problem also appears, if the normal text-file "RockSongA.lst" is not part of the ZIP file, but is in the root directory.

The problem does not appear, if the Unicode-File is outside of the ZIP-file.

The problem does not appear, if the OGG file will be loaded outside of the ReadFile()...Closefile() area.


The problem appears in BltzMaxVersions 1.34 to 1.39


marksibly(Posted 2010) [#2]
Hi,

>The problem does not appear, if the Unicode-File is outside of the ZIP-file.

This sounds like it's something to do with zipstream, not bmx.

We don't have anything to do with zipstream.


Midimaster(Posted 2010) [#3]
Hi Mark,

I also contacted Koriolis for having a look on it. The strange thing is, that not the reading of the Unicode file causes the crash, but the normal text file, which I try to read ( a long time) afterwards.

With my message I only want to tell, that this problem occurs. Perhaps someone later will find it helpful. I needed hours to find the reason for this crash. In my game code there was absolut no visible relationship between this three conditions. And there was also a lot of time between the loading of unicode and the next text stream, and also a lot of loading of pictures, etc..

My current workaround is very easy: I do not pack the Unicode-file into the zip, but link it with INCBIN direct into the exe. And everything works fine.


Grisu(Posted 2010) [#4]
How about using GMan's Zip module as cross-reference?


Koriolis(Posted 2010) [#5]
This was indeed a bug in zipstream (though in no way related to unicode). I have just fixed it, please download the latest version.


Midimaster(Posted 2010) [#6]
@Koriolis
Thank you for this excellent support!