Skip to content
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

VTK FiberSurface : detect ill-formed range polygons to avoid out-of-bounds array access #954

Merged
merged 2 commits into from
Jul 23, 2023

Conversation

Lgt2x
Copy link

@Lgt2x Lgt2x commented Jul 20, 2023

A crash could happen when using the FiberSurface filter in Paraview, when the selected range is a point cloud and not a set of 2D cells, for example when using the tool "Select Points With Polygon" instead of "Select Cells With Polygon" (it definitely did not happen to me).

cellArray[3 * i + 1] can then be out-of-bounds because we did not check the size of the connectivity array cellArray points to.

With this fix, the filter returns an error in this case and does not trigger a segfault anymore.

@Lgt2x
Copy link
Author

Lgt2x commented Jul 20, 2023

FYI @CharlesGueunet

@julien-tierny
Copy link
Collaborator

ok, looks good, thanks!

@julien-tierny julien-tierny merged commit 64371bd into topology-tool-kit:dev Jul 23, 2023
45 checks passed
#else
int *pt = polygon->GetCells()->GetPointer();
int *pt = connectivity->GetPointer();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vtkIdType would be safer here ? (@julien-tierny is SimplexId defined as vtkIdType ?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants