Le051 — `\X2\…\X0\` (UCS-2) escape: missing `\X0\` terminator

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

encoding

Sources

Description

`\X2\` opens a UCS-2 hex run that MUST close with `\X0\`. When the run folds directly into the closing apostrophe of the string literal, the directive is unterminated and a non-validating parser may consume past the apostrophe or pass a half-formed code point to its downstream UTF-8 encoder.

Reproducer recipe

`'name=\X2\30A2'` — the apostrophe closes the string while `\X2\` is still active.

Expected kernel behavior

emit `E_BAD_X2_DIRECTIVE` (unterminated) and abort decoding the string; warn-and-best-effort downstream without crashing.

Notes

**See also**: Le005, Le052, Le053. Synonyms: "backslash X2 unicode escape missing terminating backslash X0", "X2 escape missing X0 terminator", "backslash X2 hex run not closed with backslash X0", "STEP unicode escape unterminated no X0", "missing X0 terminator on X2 directive". 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

Cross-references

Le005, Le052, Le053

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Le051: \X2\...\X0\ (UCS-2) escape: missing \X0\ terminator; ISO 10303-21 Ed.3 §6.4.3.4: \X2\ opens a UCS-2 hex run that MUST close with \X0\; defect string: 'name=\X2\30A2' — the apostrophe closes the string while \X2\ is still active (unterminated directive); a non-validating parser may consume past the apostrophe or pass a half-formed code point to its downstream UTF-8 encoder; receiver must emit E_BAD_X2_DIRECTIVE (unterminated) and abort decoding; warn-and-best-effort downstream without crashing; GEOMETRIC_CURVE_SET IS model entity — OCC yields empty */
3HEADER;
4FILE_DESCRIPTION(('Le051'),'2;1');
5FILE_NAME('Le051.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#8998=PERSON('name=\X2\30A2','unterminated-x2-no-x0','');
12#8999=PERSON('valid=\X2\03B1\X0\rest','properly-terminated-x2-alpha','');
13
14ENDSEC;
15END-ISO-10303-21;