From 1e303f8cea3b9fcbcaf9f1b8625de7e9b434b1aa Mon Sep 17 00:00:00 2001 From: Algiane Froehly Date: Mon, 28 Oct 2024 16:55:33 +0100 Subject: [PATCH] Change the return value when BezierNom is called along a nonmanifold edge with 2 singular extremities. If we return 1. The point is inserted along the nom edge but its normals have not been computed (so they can be NaN). --- src/mmg3d/tools_3d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mmg3d/tools_3d.c b/src/mmg3d/tools_3d.c index d535163d3..45e20e2be 100644 --- a/src/mmg3d/tools_3d.c +++ b/src/mmg3d/tools_3d.c @@ -595,7 +595,9 @@ inline int MMG5_BezierNom(MMG5_pMesh mesh,MMG5_int ip0,MMG5_int ip1,double s,dou /* Coordinates of the new tangent and normal */ if ( MG_SIN(p0->tag) && MG_SIN(p1->tag) ) { // function should not be used in that case memcpy(to,t0,3*sizeof(double)); - return 1; + /* returning 1 here may create memory error afterward because no (that + * is not filled) will be used */ + return 0; } else if ( MG_SIN(p0->tag) ) { memcpy(n1,&(mesh->xpoint[p1->xp].n1[0]),3*sizeof(double));