mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
Avoid possible buffer overflow when checking face normals
This commit is contained in:
parent
e4583cb9b7
commit
d2a3bed240
@ -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]),
|
||||
|
Loading…
Reference in New Issue
Block a user