PT-2026-55569 · Crates.Io · Cgmath

Published

2026-03-11

·

Updated

2026-03-11

None

No severity ratings or metrics are available. When they are, we'll update the corresponding info on the page.
The Matrix2::swap columns, Matrix3::swap columns, and Matrix4::swap columns implementations call ptr::swap(&mut self[a], &mut self[b]).
When a == b, these safe APIs create two mutable references to the same matrix column and pass them to ptr::swap. This violates Rust's aliasing rules and can trigger undefined behavior. The issue can be reproduced from safe Rust by calling swap columns with identical column indices, for example m.swap columns(0, 0).
A minimal fix is to return early when the two column indices are equal before calling ptr::swap.
Found an issue in the description? Have something to add? Feel free to write us 👾

Related Identifiers

RUSTSEC-2026-0197

Affected Products

Cgmath