Repository navigation
Fix CreateFromPolyData() for non-64-bit cell storage - #53
Merged
valette merged 1 commit intoSep 16, 2026
Merged
Conversation
GetFaceVertices() returns raw pointers into the polygon connectivity and therefore relies on the vtkCellArray using 64-bit AOS storage. CreateFromPolyData() shallow-copies the input, so it inherits whatever layout the input carries. Since VTK 9.4 that can be 32-bit or fixed-size storage (vtkSurfaceNets3D emits fixed-size 32-bit cells by default), and the AOS64 downcast in GetFaceVertices() then returns null and crashes. Copy the polygons into 64-bit storage when needed. Init() already enforces 64-bit storage for meshes built from scratch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix crash in
vtkSurfaceBase::CreateFromPolyData()for non-64-bit cell storageGetFaceVertices()returns rawvtkIdType*pointers into the polygon connectivity, so it relies on thevtkCellArrayusing 64-bit AOS storage: it fetches the arrays withGetOffsetsAOSArray64()/GetConnectivityAOSArray64()(orGetOffsetsArray64()on older VTK), which areFastDownCaststhat return null for any other layout.Init()guarantees 64-bit storage for meshes built from scratch, butCreateFromPolyData()shallow-copies the input and inherits whatever layout it carries.Since VTK 9.4 cell arrays can hold 32-bit or fixed-size (implicit offsets) storage, and filters use them:
vtkSurfaceNets3D, for example, emits fixed-size 32-bit cells by default at least since VTK 9.7. Passing such a polydata toCreateFromPolyData()dereferences null inGetFaceVertices()and crashes with an access violation.Fix: when the input's polygons are not in 64-bit storage, copy them into a 64-bit
vtkCellArrayafter the shallow copy, leaving the caller's array untouched.Reproduce (VTK 9.7):
vtkSphereSource→polys->ConvertToFixedSize32BitStorage()(or anyvtkSurfaceNets3Doutput) →vtkSurface::CreateFromPolyData(). Crashes before, works after; 64-bit inputs behave as before.