summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorChris Hutchinson <chris.s.hutchinson@gmail.com>2023-02-13 19:35:16 -0500
committerChris Hutchinson <chris.s.hutchinson@gmail.com>2023-02-14 22:42:07 -0500
commitd842d215df2e4a9d0ed6231232f6301d825da1d7 (patch)
tree5acd41eadfe953ac64f0dc6940110b39fbe51db5 /scene/resources
parent4848877b802b17f4ab1aecfde42c81a7cc9b6f08 (diff)
Prevent crash in ImmediateMesh.create_outline by ensuring
that when no indices are specified, the number of vertices is at least a factor of 3. Fixes #73201
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/mesh.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index cf9baa2907..a7b53244e2 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -526,6 +526,9 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const {
vc = indices.size();
ir = indices.ptrw();
has_indices = true;
+ } else {
+ // Ensure there are enough vertices to construct at least one triangle.
+ ERR_FAIL_COND_V(vertices.size() % 3 != 0, Ref<ArrayMesh>());
}
HashMap<Vector3, Vector3> normal_accum;