-
Notifications
You must be signed in to change notification settings - Fork 142
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
derive(IntoBytes) erroneously accepts repr(C, align(X)) DSTs with dynamic trailing padding; e.g.
#[derive(IntoBytes)]
#[repr(C, align(4))]
struct Unsound([u8]);The derive accepts this because it merely confirms that [u8] is Unaligned, whereas it should be failing on the align directive. The sized analysis codepath correctly takes this into account; e.g.:
#[derive(IntoBytes)] // Compile error!
#[repr(C, align(4))]
struct Sized([u8; 3]);Bug confirmed on v0.8.39 (latest release at time of reporting), but likely present on earlier releases. Looks like this slipped in with #2679, and was probably missed because the testing infra borrowed for the sized case also doesn't reason about outer align directives.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working