FLightMap2D::Serialize(FArchive& Ar) Index '2' is out of valid index range '0' to '1' for possibly stack allocated buffer 'Textures'

Hi,

I am looking at report generated by visual studio code analysis (bEnableCodeAnalysis flag).

void FLightMap2D::Serialize(FArchive& Ar)

else if( Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_LOW_QUALITY_DIRECTIONAL_LIGHTMAPS )
	{
		for(uint32 CoefficientIndex = 0;CoefficientIndex < 3;CoefficientIndex++)
		{
			Ar << Textures[CoefficientIndex];
			Ar << ScaleVectors[CoefficientIndex];
			Ar << AddVectors[CoefficientIndex];
		}

		ScaleVectors[0].W *= 11.5f;
		AddVectors[0].W = ( AddVectors[0].W - 0.5f ) * 11.5f;

		ScaleVectors[1] *= FVector4( -0.325735f, 0.325735f, -0.325735f, 0.0f );
		AddVectors[1] *= FVector4( -0.325735f, 0.325735f, -0.325735f, 0.0f );
		AddVectors[1].W = 0.282095f;
	}


/** The textures containing the light-map data. */
	ULightMapTexture2D* Textures[2];

As you see Textures array has only 2 indexes.

Regards

Pierdek

Hi,

Thank you for pointing this out. Have you run into any errors or issues related to this?

Hi ,

It seems this doesn’t hurt me at all :wink: I was searching a buffer overrun issue in my code and finally I found this “gem”. You can close this answer.

Regards

Pierdek

Hi,

I have submitted a report about this to have it investigated further (UE-7057).