google / google/zerocopy

Does the default impl of `ProjectField::is_projectable` permit unsound union field projection?

Open
#2,941 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.6k
Forks
179
Avg merge
1d 19h
Merged PRs (30d)
29

Description

> On second re-reading, I think this is actually unsound as written. Just because a union is valid doesn't mean that any particular *field* is valid. E.g. you could initialize a union with a field value `2u8` – that doesn't mean that another field of type `bool` is valid.

_Originally posted by @joshlf in https://github.com/google/zerocopy/pull/2940#discussion_r2733481797_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.