Possible scope update for RUSTSEC-2026-0197 (cgmath swap_columns/swap_elements)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 1.2k
- Forks
- 544
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 45
Description
Possible scope update for RUSTSEC-2026-0197
Not proposing a new advisory — flagging that RUSTSEC-2026-0197's current
[affected.functions] and description may be narrower than the actual bug,
in case the affected-scope wording is worth revising. Deferring to
maintainer judgment on whether/how to update it.
The advisory currently says:
When
a == b, these safe APIs create two mutable references to the same
matrix column and pass them toptr::swap.
and lists only Matrix{2,3,4}::swap_columns as affected.
What I found doing an independent Miri sweep (posted in more detail as a
comment on the originating issue):
swap_columnsis UB for any two indices, not justa == b.m.swap_columns(0, 1)onMatrix2,m.swap_columns(0, 2)onMatrix3, andm.swap_columns(1, 3)onMatrix4— genuinely distinct columns in all three, alladvisory-listed functions — abort under Miri with the same Stacked Borrows violation as the reporteda == bcase.- The same
unsafe { ptr::swap(...) }pattern also exists inMatrix::swap_elementsandArray::swap_elements(not currently listed in[affected.functions]), and is reachable through ordinary API use —Matrix2::transpose_self()callsswap_elementsinternally and reproduces the identical UB without the caller ever namingswap_columns/swap_elementsdirectly.
Full repros, Miri output, and versions are in the linked comment on rustgd/cgmath#565 rather than duplicated here.
This doesn't change the fix recommendation (RUSTSEC-2026-0197 already correctly says swap_columns is unsound) — it's about whether [affected.functions] and the description undersell the actual reach of the bug (limited to a == b, three named functions) versus what's actually reproducible (any index pair, plus two more functions with the identical pattern). Happy to be told this is already the intended scope and the advisory is fine as-is.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the current RUSTSEC-2026-0197 advisory and the linked comment on rustgd/cgmath#565, including the Miri repros and output. Confirm whether the scope includes all index pairs and swap_elements paths; done means updating the advisory's affected.functions and description only if maintainer review accepts those findings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- security
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100