diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 2faa66b1d..325bb1a27 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -3116,7 +3116,7 @@ void MapLoader::LoadLightmap(MapData* map) fr.Read(&zdrayUvs[0], numTexCoords * 2 * sizeof(float)); // Load lightmap textures - Level->levelMesh->LMTextureData.Resize(Level->levelMesh->LMTextureCount* Level->levelMesh->LMTextureSize * Level->levelMesh->LMTextureSize * 3); + Level->levelMesh->LMTextureData.Resize(Level->levelMesh->LMTextureCount * Level->levelMesh->LMTextureSize * Level->levelMesh->LMTextureSize * 3); TArray textureData; textureData.Resize((numTexBytes + 1) / 2); @@ -3150,7 +3150,9 @@ void MapLoader::LoadLightmap(MapData* map) int dstPage = realSurface.atlasPageIndex; // Sanity checks - if (srcMinX < 0 || srcMinY < 0 || dstX < 0 || dstY < 0 || srcMaxX >= textureSize || srcMaxY >= textureSize || dstX + srcW >= textureSize || dstY + srcH >= textureSize || srcPage >= numTextures || dstPage >= Level->levelMesh->LMTextureCount) + if (srcMinX < 0 || srcMinY < 0 || srcMaxX > textureSize || srcMaxY > textureSize || + dstX < 0 || dstY < 0 || dstX + srcW > Level->levelMesh->LMTextureSize || dstY + srcH > Level->levelMesh->LMTextureSize || + srcPage >= numTextures || dstPage >= Level->levelMesh->LMTextureCount) { errors = true; if (developer >= 1)