Skip to content
Fencer Intel
no cvss —

RUSTSEC-2026-0197 json

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

published 8mo ago modified 4mo ago

cvss
—
not scored
cisa kev
Not listed
not in CISA's catalog
epss
—
no score, EPSS covers CVEs only
public exploits
0
none known

Summary

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`.

Is RUSTSEC-2026-0197 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.

Check with Fencer

Affected packages

ecosystem package affected fixed in
crates.io cgmath
>=0.0.0-0
no fix listed

References

Sources

Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.