# GHSA-q8x8-jrhj-fh9p: Diesel: Possible unaligned data access for implementations of `SqliteAggregate`

- Severity: Medium (CVSS:4.0, scored by GitHub) `CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-04-24T12:00:00.000Z
- Modified: 2026-05-20T07:26:23.800Z
- Also known as: RUSTSEC-2026-0137
- Weaknesses: CWE-188

## Description

Diesel allows to register custom aggregate SQL functions for SQLite via the `SqliteAggregate` interface.

To store an instance of the custom aggregate processor Diesel relied on the `sqlite3_aggregate_context` function 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 of `SqliteAggregate` that 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.

(As written by GitHub Advisory Database.)

## Affected

- diesel (crates.io): before 2.3.8; from 0.0.0-0 before 2.3.8

## References

- <https://github.com/diesel-rs/diesel/pull/5042> (web)
- <https://github.com/diesel-rs/diesel> (package)
- <https://rustsec.org/advisories/RUSTSEC-2026-0137.html> (advisory, web)
- <https://crates.io/crates/diesel> (package)

## Sources

- GitHub Advisory Database: [GHSA-q8x8-jrhj-fh9p](https://github.com/advisories/GHSA-q8x8-jrhj-fh9p), CC-BY-4.0, modified 2026-05-20
- RustSec Advisory Database: [RUSTSEC-2026-0137](https://rustsec.org/advisories/RUSTSEC-2026-0137.html), CC0-1.0, modified 2026-05-20

---

Page: https://cve.day/GHSA-q8x8-jrhj-fh9p · Whole record: https://cve.day/GHSA-q8x8-jrhj-fh9p.json · Rebuilt by cve.day 2026-11-25T22:56:43.352Z
