Diesel: Possible unaligned data access for implementations of `SqliteAggregate`
Moderate severity
GitHub Reviewed
Published
May 19, 2026
to the GitHub Advisory Database
•
Updated May 19, 2026
Description
Published to the GitHub Advisory Database
May 19, 2026
Reviewed
May 19, 2026
Last updated
May 19, 2026
Diesel allows to register custom aggregate SQL functions for SQLite via the
SqliteAggregateinterface.To store an instance of the custom aggregate processor Diesel relied on the
sqlite3_aggregate_contextfunction provided by sqlite. This function doesn't provide any guarantees about alignment of the returned allocation, which in turn can lead to problems if the type implementing requires a special alignment, e.g. via a custom#[align(x)]attribute on the type implementing this trait. This affects any user ofSqliteAggregatethat registers the custom aggregate function with an SQLite connection, while using a non-standard alignment on the type implementing this trait.Mitigation
The preferred mitigation to the outlined problem is to update to a Diesel version 2.3.8 or newer, which includes fixes for the problem.
Resolution
Diesel now allocates the corresponding memory on Rust side to get a correctly aligned allocation.
References