-
-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: VTKPolyDataMeshIO should not hang on inf and NaN in ASCII .vtk file #3542
BUG: VTKPolyDataMeshIO should not hang on inf and NaN in ASCII .vtk file #3542
Conversation
Is it worth it to go completely case insensitive to catch "Inf", "Nan", etc.? |
@Leengit Good question! "Infinity" and "NaN" are essential because those are the strings produced by ITK's MeshFileWriter, using I'm not aware of any other string representation of infinity and Not-A-Number that is actually being used in .vtk files. FYI, This is where our (ITK) "Infinity" and "NaN" strings come from: https://github.com/google/double-conversion/blob/af09fd65fcf24eee95dc62813ba9123414635428/double-conversion/double-to-string.cc#L44-L49 While here is where I see VTK using "%g" to output floating points: https://gitlab.kitware.com/vtk/vtk/-/blob/54a30648db36cab3b91d140a30b14176f97c254a/IO/Legacy/vtkDataWriter.cxx#L1299 Just double-checked: VTK's vtkPolyDataWriter does indeed write "inf" and "nan" for infinity and NaN values respectively, as I just tried, after building the latest version of VTK, from https://gitlab.kitware.com/vtk/vtk/-/tree/54a30648db36cab3b91d140a30b14176f97c254a/ using VS2019. |
`MeshFileReader`/`VTKPolyDataMeshIO` did hang forever when trying to read an ASCII .vtk file that contained non-numeric chars in "POINTS" section, for example "Infinity" or "NaN". With this commit, "inf" and "Infinity" will be interpreted as the floating point value infinity, while "nan" and "NaN" will be interpreted as Not-A-Number. Other strings of non-numeric characters in the list of point components (coordinates) will cause the reader to throw an appropriate `itk::ExceptionObject`. Addresses issue InsightSoftwareConsortium#3539 "MeshFileReader/VTKPolyDataMeshIO hangs forever on non-numeric chars in "POINTS" section (including "Infinity" and "NaN")"
5b0969d
to
b04d2e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 👍
MeshFileReader
/VTKPolyDataMeshIO
did hang forever when trying to read anASCII .vtk file that contained non-numeric chars in "POINTS" section, for
example "Infinity" or "NaN".
With this commit, "inf" and "Infinity" will be interpreted as the floating point
value infinity, while "nan" and "NaN" will be interpreted as Not-A-Number. Other
strings of non-numeric characters in the list of point components (coordinates)
will cause the reader to throw an appropriate
itk::ExceptionObject
.Addresses issue #3539
"MeshFileReader/VTKPolyDataMeshIO hangs forever on non-numeric chars in "POINTS"
section (including "Infinity" and "NaN")"