From d2a3bed2402797057a19c9a47b8ec9a27f3c3779 Mon Sep 17 00:00:00 2001 From: Dmitry Kostenko Date: Sat, 1 Jan 2022 02:07:34 +0100 Subject: Avoid possible buffer overflow when checking face normals --- src/client/mesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/mesh.cpp') diff --git a/src/client/mesh.cpp b/src/client/mesh.cpp index 9bbb3a0a8..bec72fb5e 100644 --- a/src/client/mesh.cpp +++ b/src/client/mesh.cpp @@ -348,7 +348,7 @@ bool checkMeshNormals(scene::IMesh *mesh) if (!std::isfinite(length) || length < 1e-10f) return false; - const u16 count = MYMIN(MAX_FACES_TO_CHECK * 3, buffer->getIndexCount()); + const u16 count = MYMIN(MAX_FACES_TO_CHECK * 3, buffer->getIndexCount() - 3); for (u16 i = 0; i < count; i += 3) { core::plane3df plane(buffer->getPosition(buffer->getIndices()[i]), -- cgit v1.2.3