Skip to content

Fix issue #18014: avoid overflow

mossaiby requested to merge mossaiby/vtk:mossaiby-master-patch-52671 into master

Avoid overflow when reading > 2,147,483,647 points in legacy VTK format. The issue is caused while calculating the number of points by multiplying three ints, representing the extents. The result is correctly stored in a variable of type vtkIdType. If the extents are large enough, such that the total number of points exceeds 2,147,483,647 an overflow occures and the following test fails:

if (npts != numPts)
...
    vtkErrorMacro(<< "Number of points don't match data values!");

The patch addresses the bug by casting ints to vtkIdType before multiplication.

Merge request reports