Avoid possible buffer overflow when checking face normals

This commit is contained in:
Dmitry Kostenko 2022-01-01 02:07:34 +01:00 committed by x2048
parent e4583cb9b7
commit d2a3bed240
1 changed files with 1 additions and 1 deletions

View File

@ -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]),