Explorar o código

BUG: Fixed crash in histogram computation for inf image

When an image contained an (inf) value, it caused ctkVTKHistogram to crash because the computed bin index was out of bounds.
Andras Lasso %!s(int64=8) %!d(string=hai) anos
pai
achega
7929ff3e52
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      Libs/Visualization/VTK/Widgets/ctkVTKHistogram.cpp

+ 2 - 2
Libs/Visualization/VTK/Widgets/ctkVTKHistogram.cpp

@@ -348,8 +348,8 @@ void populateIrregularBins(vtkIntArray* bins, const ctkVTKHistogram* histogram)
   ptr += component;
   for (; ptr < endPtr; ptr += componentNumber)
     {
-    if (std::numeric_limits<T>::has_quiet_NaN &&
-        vtkMath::IsNan(*ptr))
+    if ((std::numeric_limits<T>::has_quiet_NaN &&
+      vtkMath::IsNan(*ptr)) || vtkMath::IsInf(*ptr))
       {
       continue;
       }