summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Kostenko <codeforsmile@gmail.com>2022-01-01 02:07:34 +0100
committerx2048 <codeforsmile@gmail.com>2022-03-07 23:45:26 +0100
commitd2a3bed2402797057a19c9a47b8ec9a27f3c3779 (patch)
treea2419c364d855e3d94d6df9f13cf437ee2fd5def /src
parente4583cb9b74119030e390871c216d0a49a41a222 (diff)
downloadminetest-d2a3bed2402797057a19c9a47b8ec9a27f3c3779.tar.gz
minetest-d2a3bed2402797057a19c9a47b8ec9a27f3c3779.tar.bz2
minetest-d2a3bed2402797057a19c9a47b8ec9a27f3c3779.zip
Avoid possible buffer overflow when checking face normals
Diffstat (limited to 'src')
-rw-r--r--src/client/mesh.cpp2
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]),