Fix OOB access on zero-submesh entities in scene export - #197
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaces unconditional aiMesh* array allocations with conditional allocations that use nullptr when mesh counts are zero; updates project version and installation docs (Snap/.deb) and adds a Snap Store badge to README. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
SonarCloud flagged BLOCKER: `new aiMesh*[0]` creates a zero-length allocation; any subsequent index access is undefined behavior. Guard both buildAiScene and buildSceneAiScene to use nullptr when the mesh count is zero, so the inner loops (already guarded by `si < numSub`) never dereference a zero-length array. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
b6b7335 to
2f8ee0a
Compare
- Bump version: 2.14.1 → 2.14.2 - README: Add Snap Store as recommended Linux install method with badge - docs/index.html: Add Snap Store to Quick Start section Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|



Summary
new aiMesh*[0]creates a zero-length arrayChanges
Guard mesh array allocation in both
buildAiScene(single-entity) andbuildSceneAiScene(multi-entity) to usenullptrwhen the submesh count is zero. The inner iteration loops are already guarded bysi < numSub, so withnullptrinstead of a zero-length allocation, there is no undefined behavior.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
New Features
Chores