Skip to content

Clamp before cast to avoid potential overflow.

David Gobbi requested to merge dgobbi/vtk:clamp-before-cast into master

In vtkPointLocator, when the bucket index was computed, it was first converted to int, and then clamped to [0, maxbucket]. This isn't safe, because if the conversion to int fails because of a range error, then the resulting int value is undefined. The new code clamps the index before it is converted to integer.

Two unused member variables were removed (YD, ZD) and a third was renamed according to how it was being used (XD -> RowSize).

Merge request reports