mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 21:45:35 +00:00
Merge branch 'fix_ubsan_issues' into 'master'
Fix UBSAN issues See merge request OpenMW/openmw!528
This commit is contained in:
commit
ef852b2c8f
2 changed files with 23 additions and 10 deletions
|
@ -21,19 +21,32 @@ namespace DetourNavigator
|
|||
std::vector<unsigned char> result(indicesSize + verticesSize + areaTypesSize + waterSize + offMeshConnectionsSize);
|
||||
unsigned char* dst = result.data();
|
||||
|
||||
std::memcpy(dst, recastMesh.getIndices().data(), indicesSize);
|
||||
dst += indicesSize;
|
||||
if (indicesSize > 0)
|
||||
{
|
||||
std::memcpy(dst, recastMesh.getIndices().data(), indicesSize);
|
||||
dst += indicesSize;
|
||||
}
|
||||
|
||||
std::memcpy(dst, recastMesh.getVertices().data(), verticesSize);
|
||||
dst += verticesSize;
|
||||
if (verticesSize > 0)
|
||||
{
|
||||
std::memcpy(dst, recastMesh.getVertices().data(), verticesSize);
|
||||
dst += verticesSize;
|
||||
}
|
||||
|
||||
std::memcpy(dst, recastMesh.getAreaTypes().data(), areaTypesSize);
|
||||
dst += areaTypesSize;
|
||||
if (areaTypesSize > 0)
|
||||
{
|
||||
std::memcpy(dst, recastMesh.getAreaTypes().data(), areaTypesSize);
|
||||
dst += areaTypesSize;
|
||||
}
|
||||
|
||||
std::memcpy(dst, recastMesh.getWater().data(), waterSize);
|
||||
dst += waterSize;
|
||||
if (waterSize > 0)
|
||||
{
|
||||
std::memcpy(dst, recastMesh.getWater().data(), waterSize);
|
||||
dst += waterSize;
|
||||
}
|
||||
|
||||
std::memcpy(dst, offMeshConnections.data(), offMeshConnectionsSize);
|
||||
if (offMeshConnectionsSize > 0)
|
||||
std::memcpy(dst, offMeshConnections.data(), offMeshConnectionsSize);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void ESM::SavedGame::load (ESMReader &esm)
|
|||
esm.getSubNameIs("SCRN");
|
||||
esm.getSubHeader();
|
||||
mScreenshot.resize(esm.getSubSize());
|
||||
esm.getExact(&mScreenshot[0], mScreenshot.size());
|
||||
esm.getExact(mScreenshot.data(), mScreenshot.size());
|
||||
}
|
||||
|
||||
void ESM::SavedGame::save (ESMWriter &esm) const
|
||||
|
|
Loading…
Reference in a new issue