Page MenuHomePhabricator

possible memory bug in cdelete
Closed, DuplicatePublic

Description

By running valgrind I have come across several memory erros, e.g. in the
function cdelete() in ipSegmentationCombineRegion.c. It causes following
error:

28165== Source and destination overlap in memcpy(0x10E48474,

0x10E48488, 60)

28165== at 0x4024959: memcpy (mc_replace_strmem.c:402)

28165== by 0xB2C33D8: cdelete (in

/scratch/blloyd/mitk-svn-build/bin/libipSegmentation.so)

28165== by 0xB2C4B70: ipMITKSegmentationCombineRegion (in

This can be fixed by replacing "memcpy" by "memmove", which is the
suggested "official" replacement for "bcopy".
http://www.opengroup.org/onlinepubs/000095399/functions/bcopy.html

ipSegmentationCombineRegion.c, Line 161:

static void cdelete(i) /* remove edge i from active list */
int i;
{

int j;

for (j=0; j<nact && active[j].i!=i; j++);
if (j>=nact) return;	/* edge not in active list; happens at win->y0*/
nact--;
//bcopy(&active[j+1], &active[j], (nact-j)*sizeof active[0]);

DEPRECATED!

memmove(&active[j], &active[j+1], (nact-j)*sizeof active[0]); //

instead of memcpy
}

Event Timeline

Sorry for the late reaction and thanks for your report!

Markus, could you please try the suggested replacement?

Afterwards, the manual segmentation tools and interpolation should be tested extensively, because they make use of this ipSegmentation function.

this bug has been fixed in rev:23804 see T4333

since this was some time ago, i guess there are no problems with the manual segmentation tools

--> closing this bug

Merging "Utilities" component into "Other"