Advisory

RUSTSEC-2026-0135

Also known as: None

Summary

Unsound transmute while debug/display printing batch Insert statements in Diesel's SQLite backend

Details

Diesel allows users to output the generated SQL for any query DSL construct via th diesel::debug_query function as Display and Debug output.

For the particular implementation used by batch Insert statements in the SQLite backend Diesel relied on an unspecified transmute between types with a #[repr(rust)] layout. This is formally undefined behaviour as the compiler is free to change the layout of these types at any time.

This vulnerability affects users that print out batch insert statements constructed using an array/vector of values without default values using diesel::debug_query on the SQLite backend.

Mitigation

The preferred mitigation to the outlined problem is to update to Diesel version 2.3.8 or newer, which includes fixes for the problem.

Resolution

Diesel now uses a sound cast instead.

Severity

Not rated by the source.

Dates

Published
2026-04-24 12:00 UTC
Modified
2026-05-13 14:30 UTC

Affected packages and fixes

diesel

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 2.3.8 (semver)

Fixed versions

2.3.8

Fix

  • Fixed version 2.3.8
    cargo update -p diesel --precise 2.3.8

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences