Repository navigation
feat: onboard converter-example, document and harden the external ctx (-fno-ctx-members, issue #15) - #21
Merged
sleevetosleeve merged 1 commit intoNov 27, 2026
Conversation
… (issue #15) - converter-example.c now decodes through asn_decode_ctx()/uper_decode_ctx()/ aper_decode_ctx() with a file-scope asn_struct_external_ctx_t arena and frees via ASN_STRUCT_FREE_CTX, so the generated converter works unchanged with both default and -fno-ctx-members code, including chunked RC_WMORE input. - Fix arena frame aliasing: frames are now keyed by (struct address, type specifics) instead of the address alone. An inline member at offset 0 (single-member SEQUENCE wrapper) shares the parent base address, which aliased parent/child frames and broke EXPLICIT-tag decoding of such wrappers (found via check-BER-retag Nested fixture). asn_ext_ctx_get()/asn_get_struct_ctx() take an extra type_key argument; all 21 decoder fetch sites pass their specs. - Docs for end users: README section "External decode context (-fno-ctx-members)" and an expanded -fno-ctx-members entry in doc/man/asn1c.man.md listing all *_decode_ctx entry points. - Tests: tests-skeletons/check-ext-ctx.c (arena helpers: inline capacity, heap overflow, reset, dual-path fetch, key discrimination); tests-asn1c-smoke/check-ext-ctx.sh (converter-example round-trips all codecs in both codegen modes, 1-byte chunked reads, truncation, Wrap aliasing vector); Wrap type added to the 610 module with check-610 tests in both modes and a regenerated -P reference fixture. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-authored-by: sleevetosleeve <sleevetosleeve@users.noreply.github.com>
sleevetosleeve
marked this pull request as ready for review
November 27, 2026 13:57
4 of 5 tasks
sleevetosleeve
added a commit
that referenced
this pull request
Nov 28, 2026
…rtem The -fno-ctx-members entry in asn1c -h printed a literal \n because the usage string used an escaped backslash-n (\\n) instead of a newline. Verified against a fresh build: the line now wraps correctly. Also adds docs/issue-15-postmortem.md recording the external decode context feature lifecycle: the arena frame-aliasing bug caught only when converter-example was onboarded (#21) and the allocator-macro escape caught downstream (#22), why the harnesses missed both, and what would catch them earlier. Follows the existing docs/issue-NNN-*.md review pattern. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-authored-by: sleevetosleeve <sleevetosleeve@users.noreply.github.com>
3 of 4 tasks
sleevetosleeve
added a commit
that referenced
this pull request
Nov 28, 2026
…rtem The -fno-ctx-members entry in asn1c -h printed a literal \n because the usage string used an escaped backslash-n (\\n) instead of a newline. Verified against a fresh build: the line now wraps correctly. Also adds docs/issue-15-postmortem.md recording the external decode context feature lifecycle: the arena frame-aliasing bug caught only when converter-example was onboarded (#21) and the allocator-macro escape caught downstream (#22), why the harnesses missed both, and what would catch them earlier. Follows the existing docs/issue-NNN-*.md review pattern. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Co-authored-by: sleevetosleeve <sleevetosleeve@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
asn_decode_ctx()/uper_decode_ctx()/aper_decode_ctx()with a file-scopeasn_struct_external_ctx_tarena and frees viaASN_STRUCT_FREE_CTX. Since the arena takes precedence over embedded members when present, the same converter binary works with both default and-fno-ctx-membersgenerated code — verified byte-identical BER/DER/XER/JER/UPER/APER/OER/CBOR round-trips in both modes, incl. 1-byte chunked (-b 1) reads and clean truncation failures.SEQUENCE { x [1] EXPLICIT ... }wrappers) shares the parent's base address, so parent/child frames collided and EXPLICIT-tag decoding of such wrappers failed under the arena (surfaced bycheck-BER-retag.sh'sNestedfixture;check-CER.shandcheck-issue-617.shtoo). Frames are now keyed by(struct address, type specifics);asn_ext_ctx_get()/asn_get_struct_ctx()take an extratype_keyargument and all 21 fetch sites pass theirspecs.-fno-ctx-members)" (what it is, size win, arena usage pattern, contract, links) and an expanded-fno-ctx-membersentry indoc/man/asn1c.man.mdlisting all*_decode_ctxentry points.tests-skeletons/check-ext-ctx.c(arena unit test: inline capacity 8, heap overflow, reset, dual-path fetch, key discrimination);tests-asn1c-smoke/check-ext-ctx.sh(converter-example in both codegen modes × all codecs, chunked reads, truncation,Wrapaliasing vector);Wraptype added to the 610 module withcheck-610coverage in both modes and a regenerated-P -fno-ctx-membersreference fixture.Related issues
-fno-ctx-members) #15. Builds on feat: external decode context for BER/CER (-fno-ctx-members), Phase 0 #17 (Phase 0) and feat: per-codec external-context decode entry points (-fno-ctx-members, Phases 1-4) #18 (Phases 1-4), both merged.Type of change
Testing
tests-rust-compilercannot run fully in the sandbox (nocargo-clippy); its unit tests pass and the change does not alter default codegen output.Checklist
vlm_master