From b07d1aae8b18f49009313f0285cee68fbee9b46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 27 Mar 2023 15:08:26 +0200 Subject: [PATCH] MeshTools: fix concatenate() for more than 4 GB of data. This isn't as easy to auto-test, unfortunately, so hopefully the comment will ensure it doesn't regress again. --- src/Magnum/MeshTools/Concatenate.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Magnum/MeshTools/Concatenate.h b/src/Magnum/MeshTools/Concatenate.h index 84e131040..54e055b1d 100644 --- a/src/Magnum/MeshTools/Concatenate.h +++ b/src/Magnum/MeshTools/Concatenate.h @@ -133,7 +133,9 @@ template class Allocator = Containers::ArrayAllocator> void conc there, otherwise attributes that are not present in `meshes` would be garbage */ Containers::arrayResize(vertexData, 0); - Containers::arrayResize(vertexData, ValueInit, attributeStride*indexVertexCount.second); + /* A cast to std::size_t is needed in order to allow sizes over 4 GB on + 64-bit */ + Containers::arrayResize(vertexData, ValueInit, attributeStride*std::size_t(indexVertexCount.second)); } destination = Implementation::concatenate(std::move(indexData), indexVertexCount.second, std::move(vertexData), std::move(attributeData), meshes, "MeshTools::concatenateInto():");