[fixed]Crash when loading binary X file

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
Otaka
Posts: 17
Joined: Fri Nov 16, 2012 1:47 pm

[fixed]Crash when loading binary X file

Post by Otaka »

For some reason when I load several of X files in specific order my application (my modified version of jirr) is crash. When I tried to debug engine with Visual Studio in debug version of Irrlicht, the issue wasn't happened, only in release mode and very occasionally.
After some research I have found that in file CXMeshFileLoader.cpp in method readBinWord() there is no checking for end of the file, that is why some times on some files it works, some times do not work...
You can fix this by adding line as following:

Code: Select all

u16 CXMeshFileLoader::readBinWord(){
#ifdef __BIG_ENDIAN__
    const u16 tmp = os::Byteswap::byteswap(*(u16 *)P);
#else
    //START PATCH
    if((End-P)==0){
        return -1;
    }
    //END PATCH
    const u16 tmp = *(u16 *)P;
#endif
    P += 2;
    return tmp;
}
I hope in next release of engine you will fix the issue.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Crash when loading X file

Post by christianclavet »

Ho! That could perhaps explain why it crashed on my in release mode when loading an object. I had an object (would have to check if I find it back) that was crashing the application at loadtime. Tested back in debug, and it was not happening.

Once you had applied your patch, did it resolve the issue on your end completely?
Otaka
Posts: 17
Joined: Fri Nov 16, 2012 1:47 pm

Re: Crash when loading X file

Post by Otaka »

Yes.
Now none of the my X files cause the problem))
Last edited by Otaka on Thu May 09, 2013 2:57 pm, edited 1 time in total.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Crash when loading X file

Post by robmar »

Great! I have the same or similar problem. Occasional crashes in release code using. X files, couldn't debug it as error was only in release. Will test it out.
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Crash when loading X file

Post by robmar »

Checked and buffer end was passed searching for tokens!

Great job, but how did you find it, as it didn´t show in debug mode...?
Otaka
Posts: 17
Joined: Fri Nov 16, 2012 1:47 pm

Re: Crash when loading X file

Post by Otaka »

Just switched to "Release" and in settings add debug information to the project. After that I was able to attach debugger to launched application and trace it line by line :D
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Crash when loading X file

Post by robmar »

Tried that before once and it didn´t work. Anyway, one bug less!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Crash when loading X file

Post by hybrid »

Fixed in 1.8 branch, merge for trunk will follow.
Post Reply