[Bf-blender-cvs] [20f634c] master: Fix T48755: Crash UV unwrapping
Campbell Barton
noreply at git.blender.org
Wed Jun 29 03:57:25 CEST 2016
Commit: 20f634cfc21086777164dd1ba1287181c037d911
Author: Campbell Barton
Date: Wed Jun 29 11:48:50 2016 +1000
Branches: master
https://developer.blender.org/rB20f634cfc21086777164dd1ba1287181c037d911
Fix T48755: Crash UV unwrapping
===================================================================
M source/blender/editors/uvedit/uvedit_parametrizer.c
===================================================================
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 59f9cd1..4713ea7 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -740,6 +740,16 @@ static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge
{
PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v));
copy_v3_v3(v->co, co);
+
+ /* Sanity check, a single nan/inf point causes the entire result to be invalid.
+ * Note that values within the calculation may _become_ non-finite,
+ * so the rest of the code still needs to take this possability into account. */
+ for (int i = 0; i < 3; i++) {
+ if (UNLIKELY(!finite(v->co[i]))) {
+ v->co[i] = 0.0f;
+ }
+ }
+
v->u.key = key;
v->edge = e;
v->flag = 0;
@@ -3040,8 +3050,10 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf)
p_chart_boundaries(chart, NULL, &outer);
- if (!p_chart_symmetry_pins(chart, outer, &pin1, &pin2))
+ /* outer can be NULL with non-finite coords. */
+ if (outer && !p_chart_symmetry_pins(chart, outer, &pin1, &pin2)) {
p_chart_extrema_verts(chart, &pin1, &pin2);
+ }
chart->u.lscm.pin1 = pin1;
chart->u.lscm.pin2 = pin2;
More information about the Bf-blender-cvs
mailing list