Le049 — Carriage-return stripping during STEP file write

§12.1a encoding/strings

P1 — silent data loss

encoding

Sources

Description

A STEP writer normalises line endings by stripping all `\r` characters. When a string literal contains a literal carriage return (e.g., a multi-line description in a `DESCRIPTION` field), the stripping also applies inside string contexts; corrupting embedded text.

Reproducer recipe

STEP record `DESCRIPTION_ATTRIBUTE('line1\r\nline2','desc')` where the `\r` is intentional. Writer strips, output reads `line1\nline2`.

Expected kernel behavior

Heal and accept: line-ending normalisation only outside string literals; preserve string contents byte-for-byte (with proper escaping via `\X\` if needed). Must not silently strip CR.

Notes

**See also**: Le017, Le028. Provenance tier: requires-sibling-pair; bytes alone cannot demonstrate the writer-side stripping; the defect is the differential between the writer's input (string containing `\r`) and its output (string without `\r`). Demonstrating this requires both an input fixture and the corrupted output it produces, exercised through a STEP writer. Synonyms: "STEP writer strips carriage return", "CR removed during STEP write", "line endings normalised by writer", "STEP export drops CR", "writer rewrites CRLF to LF". Provenance tier: bytes-only — defect is context/metadata OCC does not read at BRep load; mutation-test verified oracle-invisible (2026-07-01).

Expected validation

occt=empty/empty gmsh=empty ifc=schema_n/a

Provenance tier

requires-sibling-pair — defect not fully embodied in fixture bytes.

Byte assertions

Tier-3 assertions

Cross-references

Le017, Le028

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Le049: Carriage-return stripping during STEP file write; OCCT MANTIS#0033602 / MANTIS#0028454: writer normalises line endings by stripping all \r characters including inside string literals; ISO 10303-21 §6.4.4: string contents must be preserved byte-for-byte; line-ending normalisation must only apply outside string contexts; defect: DESCRIPTION_ATTRIBUTE('line1\r\nline2','desc') — writer strips \r, output reads 'line1\nline2' — embedded CR silently lost; heal and accept: preserve string contents; escape via \X\ if needed; must not silently strip CR inside string literals; GEOMETRIC_CURVE_SET IS model entity — OCC yields empty */
3HEADER;
4FILE_DESCRIPTION(('Le049'),'2;1');
5FILE_NAME('Le049.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','','');
6FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
7ENDSEC;
8DATA;
9#1=CARTESIAN_POINT('',(0.0,0.0,0.0));
10#2=GEOMETRIC_CURVE_SET('',(#1));
11#8997=PERSON('line1

12line2','cr-lf-in-string','');
13#8998=PERSON('line3\X\0D\nline4','cr-escaped-in-string','');
14
15ENDSEC;
16END-ISO-10303-21;