mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Avoid possible buffer overflow when checking face normals
This commit is contained in:
parent
e4583cb9b7
commit
d2a3bed240
1 changed files with 1 additions and 1 deletions
|
@ -348,7 +348,7 @@ bool checkMeshNormals(scene::IMesh *mesh)
|
||||||
if (!std::isfinite(length) || length < 1e-10f)
|
if (!std::isfinite(length) || length < 1e-10f)
|
||||||
return false;
|
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) {
|
for (u16 i = 0; i < count; i += 3) {
|
||||||
|
|
||||||
core::plane3df plane(buffer->getPosition(buffer->getIndices()[i]),
|
core::plane3df plane(buffer->getPosition(buffer->getIndices()[i]),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue