Security mailing lists by PureSourceCode

RUSTSEC-2026-0197

not scored yet

`Matrix{2,3,4}::swap_columns` can trigger undefined behavior for identical indices

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.

Published
11 Mar 2026
Last modified
3 Jul 2026
Sources
OSVJSON

Affected

SourceVendor / ecosystemProduct / packageAffected versionsFixed in
OSV crates.io cgmath >= 0.0.0-0

References

History

  • 25 Nov 2026 20:14 UTC · OSV: first stored (published 11 Mar 2026)
An unhandled error has occurred. Reload ×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.