BRL.Stream Error
BlitzMax Forums/BlitzMax Programming/BRL.Stream Error
| ||
Hello, I just got informed, that my crypt module that I wrote a couple of years ago isn't working any more. I tried it out by myself, but I also get an error that I traced back into BRL.Stream. Does anybody have a clue how I can fix that error? Here is my module + example code: http://www.blitzforum.de/upload/file.php?id=3654 |
| ||
Your AES-Code in the method cipher:While Not Eof(in) For Local i:Int = 0 Until Self.Nb Self.State[0, i] = ReadByte(in) Self.State[1, i] = ReadByte(in) Self.State[2, i] = ReadByte(in) Self.State[3, i] = ReadByte(in) Next Self.rijndael() For Local i:Int = 0 Until Self.Nb WriteByte(out, Self.State[0, i]) WriteByte(out, Self.State[1, i]) WriteByte(out, Self.State[2, i]) WriteByte(out ,Self.State[3 ,i]) Next Wend Read loudly what is written there (ignoring the "for loop" for a second): Did I reach EOF? NO? - do the following: read a byte read a byte read a byte read a byte ... Now imagine this: file is at "EOF minus 2 Bytes" read 1 -- ok read 2 -- ok read 3 -- ouch So if you know: "within the while loop I read 4 Bytes" you have to do this: while in.Pos() + 4 <= in.Size() ... Wend Another option is to wrap them into "Try Catch"-blocks. Viel Spass, bye Ron |
| ||
Ok, alright, thats totally my fault ok. Thank you for your effort! |
| ||
Drop a line if it still crashes on reading. bye Ron |