diff options
author | Dmitry Kostenko <codeforsmile@gmail.com> | 2022-01-01 02:07:34 +0100 |
---|---|---|
committer | x2048 <codeforsmile@gmail.com> | 2022-03-07 23:45:26 +0100 |
commit | d2a3bed2402797057a19c9a47b8ec9a27f3c3779 (patch) | |
tree | a2419c364d855e3d94d6df9f13cf437ee2fd5def | |
parent | e4583cb9b74119030e390871c216d0a49a41a222 (diff) | |
download | minetest-d2a3bed2402797057a19c9a47b8ec9a27f3c3779.tar.gz minetest-d2a3bed2402797057a19c9a47b8ec9a27f3c3779.tar.bz2 minetest-d2a3bed2402797057a19c9a47b8ec9a27f3c3779.zip |
Avoid possible buffer overflow when checking face normals
-rw-r--r-- | src/client/mesh.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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]), |