Skip to content

Prevent STEP import segfault and validate required input sections#85

Merged
lmdiazangulo merged 6 commits into
devfrom
copilot/fix-core-dump-issue
May 14, 2026
Merged

Prevent STEP import segfault and validate required input sections#85
lmdiazangulo merged 6 commits into
devfrom
copilot/fix-core-dump-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Loading some STEP-based inputs can crash during adaptation (Segmentation fault) after layer import/label resolution. One failure path occurred when classification built a closed-domain vacuum from a nesting graph with no roots and dereferenced roots[0].

  • Rootless graph handling in classification

    • Treat empty-root topologies as open problems in ShapesClassification::isOpenProblem().
    • This avoids routing invalid topologies into closed-domain vacuum construction.
  • Defensive closed-domain construction

    • Add explicit guards in buildClosedVacuumDomain():
      • throw if no root exists
      • throw if the root is not classified as a conductor
    • Replaces unsafe indexing with deterministic runtime errors for malformed/ambiguous geometry classifications.
  • Input schema validation for clearer failures

    • Add explicit validation that input JSON must include top-level array sections:
      • materials
      • layers
    • If missing, fail fast with a helpful error message.
    • When model is present instead of required top-level sections, include a specific hint in the error message.
  • Regression coverage

    • Add adapter test for a rootless classification input to ensure it is classified as open and proceeds through vacuum-domain build without crashing.
    • Add adapter tests for missing layers and missing materials to validate the new input-schema error path.
auto roots = nestedGraph.roots();
if (open.size() == 1) return true;
if (roots.empty()) return true;   // new: rootless => open case
if (roots.size() > 1) return true;

Copilot AI linked an issue May 12, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 12, 2026 15:03
Copilot AI changed the title [WIP] Fix core dump caused by step file input Prevent STEP import segfault when shape nesting graph has no root May 12, 2026
Copilot AI requested a review from lmdiazangulo May 12, 2026 15:09
@lmdiazangulo
Copy link
Copy Markdown
Collaborator

@copilot this seems reasonable but in this case it seems that the user put "model" rather than "layers". We should include a check that the input file includes the minimal components needed: "materials" and "layers" and show a helpful error message if it is not the case. Create a new commit in this PR to address that.

@lmdiazangulo
Copy link
Copy Markdown
Collaborator

@copilot Also update the documentation. It seems outdated.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot this seems reasonable but in this case it seems that the user put "model" rather than "layers". We should include a check that the input file includes the minimal components needed: "material...

Implemented in commit 439593e. I added explicit validation that input JSON must contain top-level array sections materials and layers, with a helpful error message (including a specific hint when model is present). I also added regression tests for missing layers and missing materials.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sourceware.org
    • Triggering command: /usr/local/share/vcpkg/vcpkg /usr/local/share/vcpkg/vcpkg x-download bzip2-1.0.8.tar.gz --url=REDACTED --url=REDACTED --sha512=083f5e675d73f3233c7930ebe20425a533feedeaaa9d8cc86831312a6581cefbe6ed0d08d2fa89be81082f2a5abdabca8b3c080bf97218a1bd59dc118a30b9f3 --gdwarf-5 s/zlib/src/v1.3.-o clude libs/program_opt-I 1-2e5db616bf.cle/usr/local/share/vcpkg/buildtrees/libpng/src/v1.6.57-e296c33638.clean inja -I ees/zlib/x64-lin--64 o u/13/cc1 libs/program_optas /tmp/ccPa0HNK.s /vcpkg/vcpkg clean/pngwio.c (dns block)
  • www.mirrorservice.org
    • Triggering command: /usr/local/share/vcpkg/vcpkg /usr/local/share/vcpkg/vcpkg x-download bzip2-1.0.8.tar.gz --url=REDACTED --url=REDACTED --sha512=083f5e675d73f3233c7930ebe20425a533feedeaaa9d8cc86831312a6581cefbe6ed0d08d2fa89be81082f2a5abdabca8b3c080bf97218a1bd59dc118a30b9f3 --gdwarf-5 s/zlib/src/v1.3.-o clude libs/program_opt-I 1-2e5db616bf.cle/usr/local/share/vcpkg/buildtrees/libpng/src/v1.6.57-e296c33638.clean inja -I ees/zlib/x64-lin--64 o u/13/cc1 libs/program_optas /tmp/ccPa0HNK.s /vcpkg/vcpkg clean/pngwio.c (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Prevent STEP import segfault when shape nesting graph has no root Prevent STEP import segfault and validate required input sections May 12, 2026
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot Also update the documentation. It seems outdated.

Updated in commit cafdb71. I refreshed docs/tulip_data_format.md so the input format now documents top-level required materials and layers (and removes the outdated <model> wrapper wording). Screenshot: no UI changes (documentation-only update).

@lmdiazangulo lmdiazangulo marked this pull request as ready for review May 13, 2026 10:29
@lmdiazangulo lmdiazangulo merged commit caece20 into dev May 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core dumped caused by step file input

3 participants