Skip to content

fix(skeletons): pad short BIT STRING values to a fixed JER size - #618

Merged
mouse07410 merged 2 commits into
mouse07410:vlm_masterfrom
mr-j0nes:pr-ASN1-0105-jer-size
Nov 19, 2026
Merged

mouse07410 merged 2 commits into
mouse07410:vlm_masterfrom
mr-j0nes:pr-ASN1-0105-jer-size

Conversation

@mr-j0nes

Copy link
Copy Markdown

A BIT STRING with SIZE(8) is eight bits wide, but a value such as one decoded from BER can carry trailing zero bits in a compact form: one significant bit with seven insignificant zeros. The JER encoder compared the one-bit width with the required eight and rejected the value instead of padding it, so re-encoding that value to JER failed while XER and BER handled it.

Accept a value whose meaningful bits fit the fixed size and emit the full width, zero-filled. A value whose declared width exceeds the size is still rejected. The fixed-size cases in check-JER cover one-bit and full-byte values, widths 8/16/9, a non-byte-aligned value, the empty value, the two rejections, a callback failure and a decode/re-encode round trip.

Fixes #617

mr-j0nes and others added 2 commits November 19, 2026 11:36
A BIT STRING with SIZE(8) is eight bits wide, but a value such as one
decoded from BER can carry trailing zero bits in a compact form: one
significant bit with seven insignificant zeros. The JER encoder compared
the one-bit width with the required eight and rejected the value instead of
padding it, so re-encoding that value to JER failed while XER and BER
handled it.

Accept a value whose meaningful bits fit the fixed size and emit the full
width, zero-filled. A value whose declared width exceeds the size is still
rejected. The fixed-size cases in check-JER cover one-bit and full-byte
values, widths 8/16/9, a non-byte-aligned value, the empty value, the two
rejections, a callback failure and a decode/re-encode round trip.
Honor X.697 24.2.2 by padding or trimming only trailing zeros for NamedBitList types. Preserve JER SIZE metadata through type references, recognize equivalent named-bit values during strict validation, and exercise generated C and Rust boundaries.
@mouse07410
mouse07410 merged commit b4265af into mouse07410:vlm_master Nov 19, 2026
4 checks passed
@mr-j0nes
mr-j0nes deleted the pr-ASN1-0105-jer-size branch November 20, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JER cannot encode a fixed-size BIT STRING with trailing zero bits

2 participants