Le007 — `\X2\` endianness confusion / lone-surrogate handling

§12.1a encoding/strings (sub-class: `\X2\` directive)

P1 — silent data loss

spec-violation encoding

Sources

Description

`\X2\` 4-digit groups are big-endian by spec; parsers built on little-endian assumptions may interpret them backwards, producing wrong code points and possibly invalid surrogate pairs. A downstream UTF-8 encoder fed a lone or invalid surrogate then emits invalid UTF-8 that subsequent consumers reject (potentially via SIGABRT).

Reproducer recipe

`'\X2\D800\X0\'` (lone high surrogate).

Expected kernel behavior

validate surrogate pairing; reject lone surrogates; always interpret hex groups as big-endian.

Notes

Synonyms: "lone surrogate in STEP string", "X2 endianness wrong", "invalid UTF-8 from STEP encoder", "surrogate-half decoded as character", "STEP Unicode endian flipped". 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

bytes-only — defect not fully embodied in fixture bytes.

Byte assertions

Tier-3 assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Le007: \X2\ UCS-2 endianness confusion and lone-surrogate handling; \X2\ 4-digit groups are big-endian by spec; \X2\D800\X0\ encodes lone high surrogate U+D800 — illegal in UCS-2; parsers with little-endian assumption interpret 0xD800 as 0x00D8 producing wrong code points; downstream UTF-8 encoder fed lone surrogate emits invalid UTF-8; subsequent consumers reject invalid UTF-8 or abort (SIGABRT); receiver must validate surrogate pairing; reject lone surrogates; always interpret hex groups as big-endian; GEOMETRIC_CURVE_SET IS model entity — OCC yields empty */
3HEADER;
4FILE_DESCRIPTION(('Le007'),'2;1');
5FILE_NAME('Le007.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#8999=PERSON('\X2\D800\X0\','lone-high-surrogate-ucs2','');
12
13ENDSEC;
14END-ISO-10303-21;