Skip to content

Report an error for corrupt mesh files instead of crashing (#2048)#2597

Merged
akenmorris merged 1 commit into
masterfrom
amorris/2048-corrupt-vtk-crash
Jul 17, 2026
Merged

Report an error for corrupt mesh files instead of crashing (#2048)#2597
akenmorris merged 1 commit into
masterfrom
amorris/2048-corrupt-vtk-crash

Conversation

@akenmorris

@akenmorris akenmorris commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #2048

A malformed mesh file (e.g. the attached corrupt.vtk, whose POLYGONS size count doesn't match the connectivity that follows) crashed Studio. The original stack trace showed the crash in vtkCleanPolyData reading points out of bounds.

VTK file readers do not throw or set an error code on a malformed file; they
emit an error event and hand back partial/garbage data, which downstream
filters (e.g. vtkCleanPolyData) could then read out of bounds and crash.

Attach an error observer to each reader in MeshReader::read and throw when it
fires, so a corrupt file surfaces as a clean read error rather than a crash or
silently-loaded garbage. Add a MeshTests case covering a malformed .vtk.
@akenmorris
akenmorris merged commit 7e4208a into master Jul 17, 2026
5 of 6 checks passed
@akenmorris
akenmorris deleted the amorris/2048-corrupt-vtk-crash branch July 17, 2026 06:17
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.

Corrupt VTK file causes crash

1 participant