Skip to content

Application Framework - Early-return null NamedShape when TNaming_UsedShapes is missing#760

Merged
dpasukhi merged 1 commit intoOpen-Cascade-SAS:IRfrom
dpasukhi:named_shaped_crash
Oct 24, 2025
Merged

Application Framework - Early-return null NamedShape when TNaming_UsedShapes is missing#760
dpasukhi merged 1 commit intoOpen-Cascade-SAS:IRfrom
dpasukhi:named_shaped_crash

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

Check Acces.Root().FindAttribute(...) result in TNaming_Tool::NamedShape and return an empty Handle if the TNaming_UsedShapes attribute is not found to avoid using an uninitialized map.

…aming_UsedShapes is missing

Check Acces.Root().FindAttribute(...) result in TNaming_Tool::NamedShape and return an empty Handle
if the TNaming_UsedShapes attribute is not found to avoid using an uninitialized map.
@dpasukhi dpasukhi added this to the Release 7.9.3 milestone Oct 23, 2025
@dpasukhi dpasukhi self-assigned this Oct 23, 2025
@dpasukhi dpasukhi added 2. Bug Something isn't working 1. Application Framework CAF/XCAF/OCAF and other cases related with OCCT document labels Oct 23, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a safety check to TNaming_Tool::NamedShape to prevent accessing an uninitialized map when the TNaming_UsedShapes attribute is missing from the document root. The fix returns an empty Handle(TNaming_NamedShape) early if the attribute lookup fails.

Key Changes:

  • Added null-check for TNaming_UsedShapes attribute retrieval
  • Created comprehensive test suite for TNaming_Tool class
  • Updated CMake configuration to include new test file

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/ApplicationFramework/TKCAF/TNaming/TNaming_NamedShape.cxx Added early-return check when TNaming_UsedShapes attribute is not found
src/ApplicationFramework/TKCAF/GTests/TNaming_Tool_Test.cxx New comprehensive test suite for TNaming_Tool with 17 test cases
src/ApplicationFramework/TKCAF/GTests/FILES.cmake Registered new test file in CMake build configuration

Comment thread src/ApplicationFramework/TKCAF/TNaming/TNaming_NamedShape.cxx
@github-project-automation github-project-automation bot moved this from Todo to Integration in Maintenance Oct 23, 2025
@dpasukhi dpasukhi merged commit 7d89343 into Open-Cascade-SAS:IR Oct 24, 2025
23 checks passed
@dpasukhi dpasukhi deleted the named_shaped_crash branch October 24, 2025 08:11
@github-project-automation github-project-automation bot moved this from Integration to Done in Maintenance Oct 24, 2025
dpasukhi added a commit to dpasukhi/OCCT that referenced this pull request Dec 5, 2025
…dShapes is missing (Open-Cascade-SAS#760)

Check Acces.Root().FindAttribute(...) result in TNaming_Tool::NamedShape and return an empty Handle
if the TNaming_UsedShapes attribute is not found to avoid using an uninitialized map.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Application Framework CAF/XCAF/OCAF and other cases related with OCCT document 2. Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Attempt to get a named shape for a shape leads to a crash

4 participants