[fixed]FileSystem crash on 64-bit (Windows 8)

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

[fixed]FileSystem crash on 64-bit (Windows 8)

Post by wombat »

I was trying out Irrlicht code (trunk) on Windows 8 64-bit with Visual Studio 2012 and expierenced a crash in a call to

Code: Select all

device->getFileSystem()->addFileArchive()
while trying to add a Folder.

I could identify the source of the crash:
CFileSystem.cpp line 846:

Code: Select all

while( _tfindnext( hFile, &c_file ) == 0 );
hFile is defined as long while _tfindnext expects a initptr_t, which results in a 32 / 64 bit incompability.

The following solves the bug:

Code: Select all

--- source/Irrlicht/CFileSystem.cpp (revision 4309)
+++ source/Irrlicht/CFileSystem.cpp (working copy)
@@ -835,7 +835,7 @@
        r = new CFileList(Path, true, false);
 
        struct _tfinddata_t c_file;
-       long hFile;
+       intptr_t hFile;
 
        if( (hFile = _tfindfirst( _T("*"), &c_file )) != -1L )
        {
best regards
wombat
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: FileSystem crash on 64-bit (Windows 8)

Post by CuteAlien »

Thanks for reporting. Not sure right now if we can use intptr_t (depends if this is supported by all compilers we support ...), but definitely needs to be some pointer there and not long.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: FileSystem crash on 64-bit (Windows 8)

Post by hybrid »

Yeah, seems mingw is a bit behind, but found out about that already. Comment from header file:
/* FIXME: Should these all use intptr_t, as per recent MSDN docs? */
But this means for now we need an ifdef there, unless mingw properly resolved intptr_t to long. I don't hope so, though.
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Re: FileSystem crash on 64-bit (Windows 8)

Post by wombat »

yes it might be different for other compilers.

it was just strange because i suspected my own code to cause the crash but could'nt see how such a simple call crashed.
Post Reply