[Insight-developers] Segmentation fault with Review/Statistics

Greg Harris Gregory-Harris at uiowa.edu
Thu Dec 10 15:20:44 EST 2009


http://public.kitware.com/Bug/view.php?id=10025



Review/Statistics/itkScalarImageToHistogramGenerator.txx contains methods
for SetHistogramMin and SetHistogramMax that allocate minVector and
maxVector with size defaulted to zero instead of like this:

MeasurementVectorType minVector(1);

The result of executing it this way:

MeasurementVectorType minVector;

is a memory fault crash.



cvs diff itkScalarImageToHistogramGenerator.txx
Index: itkScalarImageToHistogramGenerator.txx
===================================================================
RCS file: 
/cvsroot/Insight/Insight/Code/Review/Statistics/itkScalarImageToHistogramGen
erator.txx,v
retrieving revision 1.4
diff -r1.4 itkScalarImageToHistogramGenerator.txx
79c79
<   MeasurementVectorType minVector;
---
>   MeasurementVectorType minVector(1);
91c91
<   MeasurementVectorType maxVector;
---
>   MeasurementVectorType maxVector(1);



More information about the Insight-developers mailing list