Repository navigation
Conversation
Collaborator
|
Thanks for the careful report and fix. The root cause turned out to be the key encoding rather than This comment was written with AI assistance (Claude Code) and checked by me. |
nicolas-abril
added a commit
that referenced
this pull request
Sep 28, 2026
…file's namespace and a foreign CID(None) keeps meaning Base's None (#1045) A file's names were keyed namespace + "." + name, and the entry file, whose namespace is "", keys its names bare. So the entry's declaration lib.None took the key lib.bend's own None would have had, and lib.bend's foreign C and JS, whose CID(k) tries lib.k before k once every file has loaded, returned the entry's constructor where lib.bend meant Base's None: the wrong match arm, and on C a read of the allocator's bump word and a free into the wrong size class. The namespace now joins its names with ":", which neither a name nor a path holds, so a key names its file: lib.bend's None is lib:None, and the entry's lib.None stays lib.None. An alias expands to ns:name, c_ids tries ns:k then k, and name_show splits a key at its ":". A key no alias reaches is shown as it is (sub/deep:Box); the unsafe list says unsafe_lib:boom. The entry may now declare lib.x beside lib.bend's x, a file may be named like a Base type (U32.bend with show) or declare its own name (lib.bend with lib.lib), and a file reaches another's names only through its aliases. tests/io/cid_capture is from #1095: a forged None and a three-field Con over a List node print None and 6 on every lane. Co-authored-by: oxura <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
nicolas-abril
added a commit
that referenced
this pull request
Sep 28, 2026
…on lands in another file's namespace and a foreign CID(None) keeps meaning Base's None (#1045) A file's names were keyed namespace + "." + name, and the entry file, whose namespace is "", keys its names bare. So the entry's declaration lib.None took the key lib.bend's own None would have had, and lib.bend's foreign C and JS, whose CID(k) tries lib.k before k once every file has loaded, returned the entry's constructor where lib.bend meant Base's None: the wrong match arm, and on C a read of the allocator's bump word and a free into the wrong size class. A key now joins its namespace with ":", which neither a name nor a path holds, so a key names its file: lib.bend's None is lib:None, and the entry's lib.None stays lib.None. An alias expands to ns:name, c_ids tries ns:k then k, and name_show splits a key at its ":". The ":" never leaves the compiler: name_key spells ns:name as ns.name wherever a key is written out (messages, the unsafe lists, a printed main, JS tags, effect ids and exports, SHOW_NAMES, BendTT names), so every output reads as before. The entry may now declare lib.x beside lib.bend's x, a file may be named like a Base type (U32.bend with show) or declare its own name (lib.bend with lib.lib), and a file reaches another's names only through its aliases. tests/io/cid_capture is from #1095: a forged None and a three-field Con over a List node print None and 6 on every lane. Co-authored-by: oxura <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
nicolas-abril
added a commit
that referenced
this pull request
Oct 1, 2026
…on lands in another file's namespace and a foreign CID(None) keeps meaning Base's None (#1045) A file's names were keyed namespace + "." + name, and the entry file, whose namespace is "", keys its names bare. So the entry's declaration lib.None took the key lib.bend's own None would have had, and lib.bend's foreign C and JS, whose CID(k) tries lib.k before k once every file has loaded, returned the entry's constructor where lib.bend meant Base's None: the wrong match arm, and on C a read of the allocator's bump word and a free into the wrong size class. A key now joins its namespace with ":", which neither a name nor a path holds, so a key names its file: lib.bend's None is lib:None, and the entry's lib.None stays lib.None. An alias expands to ns:name, c_ids tries ns:k then k, and name_show splits a key at its ":". The ":" never leaves the compiler: name_key spells ns:name as ns.name wherever a key is written out (messages, the unsafe lists, a printed main, JS tags, effect ids and exports, SHOW_NAMES, BendTT names), so every output reads as before. The entry may now declare lib.x beside lib.bend's x, a file may be named like a Base type (U32.bend with show) or declare its own name (lib.bend with lib.lib), and a file reaches another's names only through its aliases. tests/io/cid_capture is from #1095: a forged None and a three-field Con over a List node print None and 6 on every lane. Co-authored-by: oxura <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
nicolas-abril
added a commit
that referenced
this pull request
Oct 1, 2026
…on lands in another file's namespace and a foreign CID(None) keeps meaning Base's None (#1045) A file's names were keyed namespace + "." + name, and the entry file, whose namespace is "", keys its names bare. So the entry's declaration lib.None took the key lib.bend's own None would have had, and lib.bend's foreign C and JS, whose CID(k) tries lib.k before k once every file has loaded, returned the entry's constructor where lib.bend meant Base's None: the wrong match arm, and on C a read of the allocator's bump word and a free into the wrong size class. A key now joins its namespace with ":", which neither a name nor a path holds, so a key names its file: lib.bend's None is lib:None, and the entry's lib.None stays lib.None. An alias expands to ns:name, c_ids tries ns:k then k, and name_show splits a key at its ":". The ":" never leaves the compiler: name_key spells ns:name as ns.name wherever a key is written out (messages, the unsafe lists, a printed main, JS tags, effect ids and exports, SHOW_NAMES, BendTT names), so every output reads as before. The entry may now declare lib.x beside lib.bend's x, a file may be named like a Base type (U32.bend with show) or declare its own name (lib.bend with lib.lib), and a file reaches another's names only through its aliases. tests/io/cid_capture is from #1095: a forged None and a three-field Con over a List node print None and 6 on every lane. Co-authored-by: oxura <[email protected]> Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
Closes #1045.
A later entry declaration could take a sibling foreign file’s
CID(None)orCID(Con)by spelling the sibling’s canonical namespace. The C lane could then treat the returned tag as a value of the wrong allocation size. ForeignCID/FIDsubstitution now accepts local names only from the effect owner’s source and fallback names only from files loaded before that owner (its imports). The generated runtime’s own IDs are unchanged. Unknown names fail rather than bind to later entry declarations.tests/io/cid_capture.bendimports a trusted sibling under another alias, forges bothNoneand a three-fieldCon, consumes theMayberesult, and drops theListresult. Before the fix interpreted JS printedSomeinstead ofNone; after it, interpreted JS, emitted JS and native C printNone/6. The native regression also ran under AddressSanitizer without a report. An existing imported effect with module-local constructors (marshal_imported_nullary) still runs on JS and C.bun gates/repo.ts: PASS 46/46. Cluster and macOS not run.