Skip to content

Zero-length mChildren arrays should be nullptr - #5749

Merged
kimkulling merged 3 commits into
assimp:masterfrom
RichardTea:issue_5748
Sep 3, 2024
Merged

kimkulling merged 3 commits into
assimp:masterfrom
RichardTea:issue_5748

Conversation

@RichardTea

Copy link
Copy Markdown
Contributor

Fixes issue #5748

The documentation says that aiNode::mChildren == nullptr when mNumChildren == 0.

Verify this is the case in the Scene Validation post-processing step so that unit tests should spot this logic error in the future.
Found and fixed in FBX, 3DS, COB and SMD.

No other cases spotted by the current unit tests.

aiNode::mChildren should be left nullptr instead.
Zero-length array allocations are surprising and consume bookkeeping space.
Leave as null when no children
This is the simplest way to get the unit tests to detect the logic error
This should never fire in real models, it indicates a bug in assimp itself.

@kimkulling kimkulling left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks fine.

@kimkulling
kimkulling merged commit c1ffbfe into assimp:master Sep 3, 2024
@kimkulling

Copy link
Copy Markdown
Member

Merged, thanks a lot for your contribution.

@RichardTea
RichardTea deleted the issue_5748 branch September 3, 2024 13:21
kimkulling pushed a commit that referenced this pull request Jul 1, 2026
- Children: Don't allocate a zero-length array
- aiNode::mChildren should be left nullptr instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants