0001179: Fix null context crash in ShapeUpgrade_FaceDivide::Perform()#1203
Open
gsdali wants to merge 3 commits intoOpen-Cascade-SAS:IRfrom
Open
0001179: Fix null context crash in ShapeUpgrade_FaceDivide::Perform()#1203gsdali wants to merge 3 commits intoOpen-Cascade-SAS:IRfrom
gsdali wants to merge 3 commits intoOpen-Cascade-SAS:IRfrom
Conversation
ShapeUpgrade_FaceDivide::Perform() crashes with a null pointer dereference in SplitCurves() at Context()->Apply() because myContext is never initialized. Unlike ShapeUpgrade_ShapeDivide (which creates a default ShapeBuild_ReShape context in its Perform()), FaceDivide inherits directly from ShapeUpgrade_Tool which does not allocate a context. The fix adds lazy context initialization at the top of Perform(), matching the pattern used by ShapeUpgrade_ShapeDivide::Perform(). Crash reproduces both single-threaded and under concurrent execution on Windows (MSVC 19.44) and macOS (Apple Clang 21). Reproducer: https://github.com/gsdali/OCCTSwift/blob/main/Tests/occt_parallel_crash_portable.cpp CI verification: https://github.com/gsdali/OCCTSwift/actions/runs/24509869728
QA DRAW command OCC1179 tests ShapeUpgrade_FaceDivide::Perform() with no pre-set context, both single-threaded (10 iterations) and parallel (300 concurrent tasks via OSD_Parallel::For). Without the fix, the first call crashes with SIGSEGV at SplitCurves() -> Context()->Apply() due to null myContext handle. Tcl test: tests/bugs/heal/bug1179 DRAW command: OCC1179 (registered in QABugs_20.cxx)
Apply clang-format corrections and replace em-dash with ASCII hyphen in code comment.
Member
|
Dear @gsdali Thank you for your patch. To proceed with integration, please complete signing CLA process: In case if you already have signed CLA, please share ID that OCCT team shared with your by email after accepting of CLA. After CLA I will review your code and update the PR. I will clean up comments, remove the QA test and move that test into GTest(C++), not DRAW. |
Author
|
License agreement submitted.
Many Thanks,
…--
Edward Lynch-Bell
http://www.linkedin.com/in/edlynchbell/
+61 490 375 565
On Apr 17, 2026 at 16:38 +1000, Pasukhin Dmitry ***@***.***>, wrote:
dpasukhi left a comment (Open-Cascade-SAS/OCCT#1203)
Dear @gsdali
Thank you for your patch. To proceed with integration, please complete signing CLA process:
The links: Contribution Guide
Or https://dev.opencascade.org/get_involved
Please validate the filled fields, all fields are requiered, only with exception if written (optional).
In case if you already have signed CLA, please share ID that OCCT team shared with your by email after accepting of CLA.
After CLA I will review your code and update the PR. I will clean up comments, remove the QA test and move that test into GTest(C++), not DRAW.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
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.
Issue
Fixes #1179
Problem
ShapeUpgrade_FaceDivide::Perform()crashes with a null pointer dereference inSplitCurves()atContext()->Apply()becausemyContextis never initialized.ShapeUpgrade_FaceDivideinherits fromShapeUpgrade_Tool, which does not allocate a defaultShapeBuild_ReShapecontext. The sibling classShapeUpgrade_ShapeDividehandles this correctly with lazy initialization in its ownPerform():But
ShapeUpgrade_FaceDivide::Perform()has no such guard.Crash details
ShapeUpgrade_FaceDivide::SplitCurves() + 168—KERN_INVALID_ADDRESS at 0x0Fix
Add lazy context initialization at the top of
Perform(), matching the pattern used byShapeUpgrade_ShapeDivide:Verification