-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
CYFS/src/component/cyfs-base/src/objects/chunk.rs
Lines 157 to 159 in 9eaf33f
| pub fn as_object_id(&self) -> &ObjectId { | |
| unsafe { std::mem::transmute::<&ChunkId, &ObjectId>(&self) } | |
| } |
The safe method
as_object_id used transmute to convert &ChunkId to &ObjectId. When we use transmute on reference, we need to ensure the layout (e.g., size and alignment) by ourselves. Even though ChunkId and ObjectId have the same type definition, rust compiler preserves the right to reorder and add padding bytes to the struct of repr(Rust) representation. Suggest to add repr(C) to both struct to make this guarantee.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels