Skip to content
  • Andras Lasso's avatar
    BUG: Fix crash in vtkImageHistogram if input contains NaN · 1a889f6d
    Andras Lasso authored
    vtkImageHistogram caused application crash when input image contained NaN value
    using Intel TBB backend, Visual Studio 2017, x64.
    
    The problem was that when the image contained a NaN value then the computed scalar range was set to (Nan, Nan),
    which later got converted to invalid bin min/max indexes. The safety check that should have forced
    the indices to the valid range did not work, as it relied on comparison with a NaN value.
    
    Fixed computation of scalar range (similar to how it is done here:
    vtk/vtk@06d553fb), by changing
    the order of operands in the ternary operator.
    
    To make sure that similar error do not cause crash in the future, added a NaN-value check in the bin range computation, too.
    
    Added test case to verify that the results are correct and the application does not crash anymore if input image contains NaN.
    1a889f6d