Skip to content

corlib: composing a type name never writes through a null type ref - #2534

Open
jayrulez wants to merge 1 commit into
beefytech:masterfrom
jayrulez:fix/type-getfullname-null-typeref
Open

jayrulez wants to merge 1 commit into
beefytech:masterfrom
jayrulez:fix/type-getfullname-null-typeref

Conversation

@jayrulez

Copy link
Copy Markdown
Contributor

A type id can name a type the runtime type table has no entry for, and GetType answers null for it. Every place GetFullName composed a name out of another type id wrote through that null and took the process down with a segfault: a tuple's field types and splat members, a base type, a pointer's and a ref's and a sized array's element, an array's element, and a specialization's unspecialized form, which was also a hard cast that trapped on null.

An unresolvable reference now reads as "???", which is the placeholder an unresolvable outer type already used.

This kills any walk over Type.Types that names what it finds, which is how a reflection driven registry resolves a type by name: one tuple whose field type was never emitted ends the process with no assertion text.

A const String expression's literal is guarded for a null entry as well, but only for that: String.GetById indexes the literal table unchecked, so an id BEYOND the table still reads out of bounds. Catching that needs a count emitted beside the table, so it is left alone here and the call site says so.

@bfiete please let me know if I should pursue the count emission.

A type id can name a type the runtime type table has no entry for, and GetType
answers null for it. Every place GetFullName composed a name out of another
type id wrote through that null and took the process down with a segfault: a
tuple's field types and splat members, a base type, a pointer's and a ref's and
a sized array's element, an array's element, and a specialization's
unspecialized form, which was also a hard cast that trapped on null.

An unresolvable reference now reads as "???", which is the placeholder an
unresolvable outer type already used.

This kills any walk over Type.Types that names what it finds, which is how a
reflection driven registry resolves a type by name: one tuple whose field type
was never emitted ends the process with no assertion text.

A const String expression's literal is guarded for a null entry as well, but
only for that: String.GetById indexes the literal table unchecked, so an id
BEYOND the table still reads out of bounds. Catching that needs a count emitted
beside the table, so it is left alone here and the call site says so.
@jayrulez
jayrulez force-pushed the fix/type-getfullname-null-typeref branch from f5bad8f to e44847f Compare September 25, 2026 03:33
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.

1 participant