Segmentation Fault while running cmrep_vskel (TSA Advanced Tutorial) and possible solution

29 views
Skip to first unread message

SK

unread,
Dec 21, 2017, 12:40:13 PM12/21/17
to DTI-TK
I ran into the following error while running cmrep_vskel step from TSA Advanced tutorial:

TSAtry]$ ~/library/cmrep-master/build/cmrep_vskel -Q ~/library/qhull-2015.2/Build/qvoronoi tract_boundary.vtk tract_skel.vtk
Bounding Box : 54.949402 97.423203 39.863701 120.560997 103.738998 0.000000
Segmentation fault (core dumped)

I am on a 64-bit CentOS 7 machine.

Digging into VoronoiSkeletonTool.cxx code (that produces cmrep_vskel binary), I located the error to the following code snippet:

#ifndef WIN32
char fnTemplate[] = "/tmp/voronoi_pts.XXXXXX";
char *fnPoints = mktemp(fnPoints);
#else
char *fnPoints = tmpnam(NULL);
#endif

For some reason, this snippet was producing an empty fnPoints (temporary file name) which was causing an improper fopen operation resulting in segmentation fault. I got cmrel_vskel to not result in segmentation fault by replacing the above snippet with the following:

// #ifndef WIN32
// char fnTemplate[] = "/tmp/voronoi_pts.XXXXXX";
// char *fnPoints = mktemp(fnPoints);
// #else
// char *fnPoints = tmpnam(NULL);
// #endif

char *fnPoints = tmpnam(NULL);

Just wanted to post this here in case anyone else runs into this error.

Reply all
Reply to author
Forward
0 new messages