Skip to content

fix(soundness): fix a soundness bug with the Maybe<T> type and the HasSchema derive macro for generic types.#456

Merged
MaxCWhitehead merged 1 commit intofishfolk:mainfrom
zicklag:fix/undefined-behavior-maybe
Sep 8, 2024
Merged

fix(soundness): fix a soundness bug with the Maybe<T> type and the HasSchema derive macro for generic types.#456
MaxCWhitehead merged 1 commit intofishfolk:mainfrom
zicklag:fix/undefined-behavior-maybe

Conversation

@zicklag
Copy link
Copy Markdown
Member

@zicklag zicklag commented Sep 8, 2024

There was a bug in the HasSchema derive macro for generic types, where the enum variant schema was returning the schema for a previously computed instantiation of the generic type, instead of specializing based on the Rust type ID.

This fixes that, fixing undefined behavior that may be triggered when using Maybe<T> along with any other generic enums that have derived HasSchema.

This should also fix #296, which I can't reproduce right now, but could have been caused randomly by Maybe::schema() being unsound.

Fixes: #296

…HasSchema derive macro for generic types.

There was a bug in the HasSchema derive macro for generic types, where the enum
variant schema was returning the schema for a previously computed instantiation of
the generic type, instead of specializing based on the Rust type ID.

This fixes that, fixing undefined behavior that may be triggered when using `Maybe<T>`
along with any other generic enums that have derived HasSchema.
@MaxCWhitehead MaxCWhitehead added this pull request to the merge queue Sep 8, 2024
Merged via the queue into fishfolk:main with commit 61d3e31 Sep 8, 2024
@zicklag zicklag deleted the fix/undefined-behavior-maybe branch September 8, 2024 18:29
RockasMockas pushed a commit to RockasMockas/bones that referenced this pull request Sep 9, 2024
…`HasSchema` derive macro for generic types. (fishfolk#456)

There was a bug in the `HasSchema` derive macro for generic types, where
the enum variant schema was returning the schema for a previously
computed instantiation of the generic type, instead of specializing
based on the Rust type ID.

This fixes that, fixing undefined behavior that may be triggered when
using `Maybe<T>` along with any other generic enums that have derived
`HasSchema`.

This should also fix fishfolk#296, which I can't reproduce right now, but could
have been caused randomly by `Maybe::schema()` being unsound.

Fixes: fishfolk#296
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.

Segfault When Loading Maybe<f32> in Metadata Asset

2 participants