[Ptinpoly-commits] r28 - in pkg: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 17 21:11:30 CEST 2014


Author: jmaisog
Date: 2014-08-17 21:11:30 +0200 (Sun, 17 Aug 2014)
New Revision: 28

Modified:
   pkg/DESCRIPTION
   pkg/src/kodtree.cc
   pkg/src/pinpolyhedronA.cc
Log:
Bug fixes to address segmentation faults. Specifically, fixed mismatched new/delete calls, and addressed topological defects (throw exceptions in these cases).

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2014-08-03 18:53:11 UTC (rev 27)
+++ pkg/DESCRIPTION	2014-08-17 19:11:30 UTC (rev 28)
@@ -1,7 +1,7 @@
 Package: ptinpoly
 Title: Point-In-Polyhedron Test (2D and 3D)
-Version: 2.3
-Date: 2014-08-03
+Version: 2.4
+Date: 2014-17-03
 Author: Jose M. Maisog, Yuan Wang, George Luta, Jianfei Liu
 Maintainer: Jose M. Maisog <bravas02 at gmail.com>
 Description: Function 'pip3d' tests whether a point in 3D space is

Modified: pkg/src/kodtree.cc
===================================================================
--- pkg/src/kodtree.cc	2014-08-03 18:53:11 UTC (rev 27)
+++ pkg/src/kodtree.cc	2014-08-17 19:11:30 UTC (rev 28)
@@ -822,6 +822,7 @@
 		for(int i=0;i<3;i++){
 			if(tneighb[ctri][i]>=0) continue;
 			int tnb=getNeighbTriWithoutTopology(trips,ctri,i);
+            if(tnb < 0) throw(7);  /* JMM : 8/17/2014 : Fix Seg Fault as per B. Ripley and J. Liu */
 			if(trisort[tnb]==0){
 				if(!triSortAs2Nodes(trips[tnb],trips[ctri][(i+2)%3],trips[ctri][(i+1)%3]))
 					swap(trips[tnb][0],trips[tnb][1]);

Modified: pkg/src/pinpolyhedronA.cc
===================================================================
--- pkg/src/pinpolyhedronA.cc	2014-08-03 18:53:11 UTC (rev 27)
+++ pkg/src/pinpolyhedronA.cc	2014-08-17 19:11:30 UTC (rev 28)
@@ -268,6 +268,7 @@
 		int tri0,tri;
 		tri0=tri=triofnode[v];
 		do{
+            if(tri < 0) throw(7); /* JMM : 8/17/2014 : Fix Seg Fault as per B. Ripley and J. Liu */
 //			if(triused[tri]==1) continue;
 //			else triused[tri]=1;
 			getEndPointOfTri(tri,p0,p1,p2);
@@ -442,7 +443,7 @@
 
 	getVertsAroundaVert(vert,neighbverts,numbv);
 	getThePointFormingLeastAngleWith2Points(p,vert,neighbverts,numbv,maxcosa,vertridge);
-	delete neighbverts;
+	delete [] neighbverts; /* JMM : 8/17/2014 : Fix Seg Fault as per B. Ripley */
 	if(maxcosa>epscoplanar)
 	//{
 	//	get2TriCom2Vert(vert,vertridge,tria,trib);



More information about the Ptinpoly-commits mailing list