Skip to content

v4.0.0-beta.7

Pre-release
Pre-release

Choose a tag to compare

@gsdali gsdali released this 04 Nov 07:18
· 31 commits to main since this release
1653e2b

The beta that pins v4.0.0-kernel.8 and refuses damaged BREP and binary OCAF files instead of crashing on them. Since v4.0.0-beta.6 14 pull requests have merged: nine more carried kernel patches on both platforms, bridge guards for truncated BREP text and malformed binary OCAF, one input the BREP text readers now refuse that they used to load, and CI changes.

Kernel: v4.0.0-kernel.8

OCCT V8_0_1 plus 59 carried patches (0010 to 0078, retired numbers absent), native and wasm, built from the same commit and attached to the same release. Scripts/check-wasm-kernel-parity.py reports the two clean with no acknowledgement standing. Nine patches are new since kernel.7, all for damaged input, which now answers a refusal where it killed the process, hung or ran out of memory:

  • 0070, 0071, 0072 and 0078 (#3489), binary OCAF: a size read from the file is compared without overflow, an array or list span the record cannot hold is refused, a table name longer than the reader's buffer is cut at the buffer, and a label nested past 512 levels is refused with PCDM_RS_UnrecognizedFileFormat instead of overflowing the stack of the thread that opens the file.
  • 0073, 0074 and 0076 (#3490, #3495), text and binary BREP: a token longer than the buffer, a failed stream, a count the stream cannot supply, a reference outside its table and a position reference that leaves the stream are refused. The readers return nil or throw ImportError instead of faulting or spinning.
  • 0075 (#3496): a trimmed curve or surface record whose parameter is NaN or infinite is dropped and the rest of the file reads as before. It used to fault or never return.
  • 0077 (#3490): BRepCheck_Analyzer reports NoCurveOnSurface for a face with no surface, or an edge with only a curve on a surface, instead of faulting.

The six suites that pin these (BREPKernelTrimParameterTests, BinToolsPositionReferenceTests, BREPKernelDamagedReadTests, BREPKernelRecordCountTests, BREPKernelInconsistentShapeTests, OCAFBinaryDocumentDataKernelReadTests) are ungated by this repin and run on wasm as well. On kernel.7 each one fails, hangs or ends the test process.

Breaking, in docs/SEMVER.md with a migration

v4.0.0 is a major by SemVer Rule 2, and this is recorded for it.

  • Shape.loadBREP(from:), Shape.loadBREP(fromPath:) and Shape.fromBREPString(_:) refuse a BREP whose trailing whitespace was stripped (#3487, #3492). A written BREP ends in a space, so a file that ends mid-token is the mark of a cut one, and the complete file without its last space is a prefix of itself. It used to load and now throws ImportError.importFailed or returns nil. Migration: stop trimming a stored BREP, or append a newline or a space after the root reference; the reader accepts any whitespace there. The output of toBREPString() and of the BREP writers loads as before. Silent behaviour change; #3492 stated PATCH and the assembly recorded it MAJOR.

No Swift declaration was added, changed or removed in this beta. The C bridge gains OCCTDocumentOCAFDeclaredSizesFit (#3485), a test seam with no Swift wrapper.

Crash to refusal

  • A truncated BREP no longer kills the process (#3487, #3492). Shape.loadBREP and Shape.fromBREPString read through a stream that throws where the file ends, so every strict prefix of a written BREP is refused, as is a text word of 255 bytes or more. Measured over 28,977 prefixes of 18 written files: all refused, none faulted.
  • Binary OCAF files that lie about their size are refused before OCCT acts on it (#3477, #3485): a string length or section count larger than the bytes the file holds makes Document.loadOCAF(from:) return (nil, .driverFailure), instead of OCCT allocating by a number the file made up, which on 32-bit wasm failed the allocator for the rest of the process. The same answer for a type, root or reference index outside the tables the file declares and for a 512-byte table name (#3486, #3488).

Tests and tooling

  • The macOS CI jobs run on macos-latest (#3481, #3482), the code-style job pins swift-format and SwiftLint (#3483, #3484), and the release-mode scribble job sets MallocMediumZone=0 against a libmalloc crash on macOS 15 (#3479, #3480).
  • The upstream-process pages, skills and policies are rewritten around OCCT's own AI instructions, issue first (#3499).
  • On wasm, Swift Testing's .timeLimit fails every test that carries it ("Time limit was exceeded") whatever the body's duration; the suite that needed it uses the .enabled(if: true) substitute the repo already uses for BREPDamagedInputTests.

Known open items

  • BREP text readers: #3490 stays open. Its three items are covered by 0073, 0074 and 0077, but the 110,000-case matrix was measured on kernel.7 and has not been re-run on kernel.8, and the loadBREP and fromBREPString doc comments still say a complete-but-wrong file can fault the reader. Until it closes, do not load a BREP from a source you do not trust.
  • Bridge guards: the occtShapeHasPCurveOnlyEdge and occtShapeHasSurfacelessFace guards (#2750, #2789) were to come out at the repin that pins 0077. They stay until the BRepCheck_Wire path is measured on kernel.8 (#3503).
  • Build scripts: Scripts/build-occt-wasm.sh refuses an occt-src tree that build-occt.sh already patched once a patch has been rewritten by a later one (#3502); build the wasm kernel from a fresh clone.
  • Wasm and held: #2757 (setjmp plus wasm exceptions in one function emits an invalid br_table) is open upstream. #2863 (an ASan-instrumented kernel) and #1403 (per-format STEP controller singleton ownership) are held. The fillet and chamfer defect set under #3334 is open, with #3428 in it.
  • The CHANGELOG entries for #3491, #3493, #3494, #3497, #3498 and #3500 were written before the repin and say the fix arrives "once the kernel carries" the patch; they are live in this release.

Still a pre-release

v4.0.0 is a major by SemVer Rule 2 and stays open until OCCT 8.0.2 ships. The breaks are listed with migrations in docs/SEMVER.md, and the full history is in docs/CHANGELOG.md.

Verification

CHANGELOG audited with --verify-transcribed since v4.0.0-beta.6: 14 merges, 10 transcribed, 3 opted out, 1 with no entry (#3499, documentation only, no file under Sources/). Both kernel pins checked by check-wasm-kernel-parity.py, clean with no acknowledgement; Package.swift's checksum: equals the published digest of OCCT.xcframework.zip on v4.0.0-kernel.8 (8d737fb2b4d4eaf2079ca1c648076b6ad0f00f4d28239f96241ecb47d15880e7), and Scripts/wasm-kernel-pin.txt carries the published sha256 of libOCCT-wasm.tar.gz (48532d0ab811432d483a7e84bebd86e889a6c3634224a7f6178dd09581ba682e). Every static gate in gate-scripts and its --self-test exit 0, and swiftlint lint --strict, check-swift-format.py and format-bridge.sh --check exit 0. Operation count derives 4,403 and agrees with every headline (1,196 bridged OCCT headers). Full swift test against v4.0.0-kernel.8: 7077 tests in 1671 suites passed with 6 known issues, in CI on the release merge commit 1653e2b68 (macOS). The wasm job passes on the repin PR with the ungated OCCTIOTests (258) and OCCTXCAFTests (522).