Game Development Community

T3D 1.2 ShapeBaseImageData::StateData uninitialized heap storage causes client crash when mounting image.

by kcpdad · in Torque 3D Professional · 02/13/2012 (4:52 am) · 1 replies

Build: T3D Pro 1.2

(what platform/OS did this happen on?)
Platform: Windows Vista/7/XP, 32 or 64 bit

Target: Visual Studio and just plain release builds

Issues: Mounting a Flag ShapeBaseImageData causes the client to crash in ShapeBase::setImageState() because ShapeBaseImage::StateData.Transition.genericTrigger isn't initialized to -1 in the constructor.

This statement around line
if ((ns = stateData.transition.genericTrigger[i][image.genericTrigger[i]]) != -1) {
setImageState(imageSlot, ns);
ns was set to x'CDCDCDCD' due to the uninitialized heap storage which subsequently caused a crashed.
Mounting weapons didn't cause a problem, I'm not sure why.

I also had crash because shapeSequence wasn't initialized.


Suggested Fix: Add the following to ShapeBaseImageData::StateData::StateData() in shapeImage.cpp
for( U32 i=0; i < MaxGenericTriggers; ++i)
{
   for( U32 j=0; j < 2; ++j)
   {
      transition.genericTrigger[i][j] = -1;
   }
}
shapeSequence = 0;

About the author

Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/


#1
05/06/2012 (11:36 am)
I confirm this bug and to highlight it easily, just run the game with Dedicated server and a client with full template.