Fix #132566: Cycles volume render artifact with high res volume

Avoid integer overflow creating bounding mesh.
This commit is contained in:
Brecht Van Lommel
2025-01-13 09:00:38 +01:00
parent 5710e62273
commit 28ecb6ccf0

View File

@@ -97,7 +97,8 @@ static int add_vertex(const int3 v,
const int3 res,
unordered_map<size_t, int> &used_verts)
{
const size_t vert_key = v.x + v.y * (res.x + 1) + v.z * (res.x + 1) * (res.y + 1);
const size_t vert_key = v.x + v.y * size_t(res.x + 1) +
v.z * size_t(res.x + 1) * size_t(res.y + 1);
const unordered_map<size_t, int>::iterator it = used_verts.find(vert_key);
if (it != used_verts.end()) {