Skip to content

Using uninitialized memory in W3DGadgetHorizontalSliderImageDrawA #961

Open
@xezon

Description

@xezon

Using uninitialized memory in W3DGadgetHorizontalSliderImageDrawA.

Unclear why the assignment is commented out. Needs investigation.

Warning

D:\Projects\TheSuperHackers\GeneralsGameCode\GeneralsMD\Code\GameEngineDevice\Source\W3DDevice\GameClient\GUI\Gadget\W3DHorizontalSlider.cpp(380): warning C6001: Using uninitialized memory 'centerImageLeft'.
D:\Projects\TheSuperHackers\GeneralsGameCode\GeneralsMD\Code\GameEngineDevice\Source\W3DDevice\GameClient\GUI\Gadget\W3DHorizontalSlider.cpp(380): warning C6001: Using uninitialized memory 'smallCenterImageLeft'.
D:\Projects\TheSuperHackers\GeneralsGameCode\GeneralsMD\Code\GameEngineDevice\Source\W3DDevice\GameClient\GUI\Gadget\W3DHorizontalSlider.cpp(382): warning C6001: Using uninitialized memory 'centerImageRight'.
D:\Projects\TheSuperHackers\GeneralsGameCode\GeneralsMD\Code\GameEngineDevice\Source\W3DDevice\GameClient\GUI\Gadget\W3DHorizontalSlider.cpp(382): warning C6001: Using uninitialized memory 'smallCenterImageRight'.

Code

void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, WinInstanceData *instData )
{
	const Image *leftImageLeft, *rightImageLeft, *centerImageLeft, *smallCenterImageLeft;
	const Image *leftImageRight, *rightImageRight, *centerImageRight, *smallCenterImageRight;
...
	if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE )
	{

		leftImageRight = leftImageLeft					= GadgetSliderGetDisabledImageLeft( window );
		rightImageRight = rightImageLeft				= GadgetSliderGetDisabledImageRight( window );
//		centerImageRight = centerImageLeft				= GadgetSliderGetDisabledImageCenter( window );
//		smallCenterImageRight = smallCenterImageLeft	= GadgetSliderGetDisabledImageSmallCenter( window ); // <---- xezon: problem

	}  // end if, disabled
	else //if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) )
	{
...
	}  // end else, enabled

	// sanity, we need to have these images to make it look right
	if( leftImageLeft == NULL || rightImageLeft == NULL || 
			centerImageLeft == NULL || smallCenterImageLeft == NULL ||
			leftImageRight == NULL || rightImageRight == NULL || 
			centerImageRight == NULL || smallCenterImageRight == NULL )
		return;

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is not working right, typically is user facingGUIFor graphical user interfaceInvestigateMinorSeverity: Minor < Major < Critical < Blocker

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions