Ls036 — Binary literal `"…"` malformed (bit-count nibble or hex case)

§12.1c binary-literal grammar

P1 — silent data loss

syntax

Sources

Description

ISO 10303-21 BINARY syntax is `"<n><hex>*"` where `<n>` is `0`–`3` indicating unused bits in the final hex digit; hex digits are uppercase, even-count is required. Defects: lower-case hex (`"0dead"`), wrong leading nibble (`"4DEAD"` or `"FF"`), missing leading nibble, odd hex-digit count (`"3DEAD"`).

Reproducer recipe

`BINARY_VALUE := "0DEAD";` (good) vs `"0dead";` vs `"4DEAD";` vs `"FF";` vs `"3DEAD";`

Expected kernel behavior

Strict reject malformed forms; in particular enforce leading nibble in 0.3 and even hex-digit count. Lenient mode may accept lowercase but warn.

Notes

Synonyms: "malformed BINARY literal in STEP", "binary literal lowercase hex", "wrong leading nibble on BINARY", "odd hex-digit count in STEP binary", "BINARY missing leading nibble".

Expected validation

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

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)
1/* Ls036 - Binary literal malformed (bit-count nibble or hex case)
2   ----------------------------------------------------------------------
3   Catalog section : §12.1c binary-literal grammar
4   Sources         : T036, A024, N020
5   ----------------------------------------------------------------------
6   Defect
7     ISO 10303-21 BINARY syntax: "<n><HEX>*" where n in {0,1,2,3}.
8     Defect 1: "0dead" -- lowercase hex digits (must be uppercase)
9     Defect 2: "4DEAD" -- leading nibble 4 is out of range {0,1,2,3}
10     Defect 3: "FF"   -- missing leading nibble entirely
11     Defect 4: "3DAD" -- odd hex-digit count after nibble (must be even)
12   Expected behavior
13     Strict reject all four forms; lenient may accept lowercase with warning.
14   ----------------------------------------------------------------------
15*/
16ISO-10303-21;
17HEADER;
18FILE_DESCRIPTION(('Ls036 - malformed BINARY literals'),'2;1');
19FILE_NAME('Ls036.stp','2026-06-20T00:00:00',('auto-generated'),(''),
20  'auto-generated','','');
21FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
22ENDSEC;
23DATA;
24/* Defect 1: lowercase hex digits in binary literal -- "0dead" */
25#1=BINARY_ATTR('lc-hex',"0dead");
26/* Defect 2: leading nibble out of range -- "4DEAD" (nibble must be 0-3) */
27#2=BINARY_ATTR('bad-nibble',"4DEAD");
28/* Defect 3: missing leading nibble entirely -- "FF" */
29#3=BINARY_ATTR('no-nibble',"FF");
30/* Defect 4: odd hex-digit count after nibble -- "3DAD" (3 hex digits, not even) */
31#4=BINARY_ATTR('odd-count',"3DAD");
32ENDSEC;
33END-ISO-10303-21;