Game Development Community

T3D 1.1 Betas Engine crashes when calculating the CRC of an empty file /w Fix - LOGGED

by Thomas · in Torque 3D Professional · 10/07/2010 (9:32 am) · 3 replies

Build: 1.1 Beta 2 & 3

Target: Script Console

Issues: When calculating a CRC of an empty file, Torque crashes.

Steps to Repeat:
0. Create a simple e.g. test.cs
1. Launch the game
2. Open Console
3. type getFileCRC( "test.cs" );
4. ...

Suggested Fix: For People with code access
alter winVolume.cpp line 362
U64   fileSize = getSize();
if( !fileSize ) // Added
    return 0;   // Added

without code access check the filesize before calculating the CRC, with
if( fileSize( "test.cs" ) != -1 )
    getFileCRC( "test.cs" );
//else
// CRC is 0!


#1
10/07/2010 (2:03 pm)
Logged as TQA-1165 for the QA team to verify.
#2
11/08/2010 (7:31 pm)
@Thomas
I've been unable to reproduce this one. How are you creating the test file you're using, is it via a specific program or just via explorer? Are there any errors in the console log when you get this crash?
#3
11/09/2010 (5:36 am)
Hi Scott,

I've just read an file from original torque system. It's odd, I had the crash in Beta2, looking in the code, it's easy:
FrameTemp<U8>   buf( fileSize );
is defined in
FrameTemp( const U32 count = 1 ) : mNumObjectsInMemory( count )
   {
     AssertFatal( count > 0, "Allocating a FrameTemp with less than one instance" );
...
with an empty file this stops me out.

Ok, Memory handler behaves like intented, but that's not the aim of the CRC calculation, isn't it? Or isn't CRC calculation of an empty file allowed?