Fix segfault when loading an assembly with no children from xml/xbf#2065
Open
HaozheZhang6 wants to merge 1 commit into
Open
Fix segfault when loading an assembly with no children from xml/xbf#2065HaozheZhang6 wants to merge 1 commit into
HaozheZhang6 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2065 +/- ##
=======================================
Coverage 95.70% 95.70%
=======================================
Files 30 30
Lines 9447 9447
Branches 1406 1407 +1
=======================================
Hits 9041 9041
Misses 252 252
Partials 154 154 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
An assembly holding a single shape and no children has no name attribute on its top-level label after an XCAF round trip. _importDoc called FindAttribute on that label unconditionally, which segfaults instead of returning false. Use the existing _get_name helper, which checks IsAttribute first, and keep the generated name when the file does not carry one.
HaozheZhang6
force-pushed
the
fix/assembly-load-segfault
branch
from
July 14, 2026 05:48
aa9b454 to
3f591b8
Compare
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.
Loading an assembly that holds a single shape and no children crashes the interpreter:
Same for
.xbf. Adding a single child makes it go away, which is why the existing round-trip tests do not hit it -- every fixture has children. STEP is unaffected.Cause: such an assembly has no
TDataStd_Nameon its top-level label after the XCAF round trip, and_importDoccallsFindAttributesegfaults on a label that does not carry the attribute rather than returning false:The module already has a helper that gets this right --
_get_namechecksIsAttributebefore callingFindAttribute-- so use it, and keep the generated name when the file does not carry one.Test:
test_assembly_without_children_roundtripparametrized over step/xml/xbf. On master the xml and xbf cases take the whole pytest process down with SIGSEGV.