# RUSTSEC-2025-0164: `DTriangle` accessors may read out of bounds in affected versions

> Safe Rust code can trigger undefined behavior via out-of-bounds reads in DTriangle accessors, requiring an upgrade to the fixed version.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 24 Apr 2025

## What is RUSTSEC-2025-0164?

RUSTSEC-2025-0164 is a memory corruption vulnerability in i_triangle, published on 24 Apr 2025. 

### Official description

In affected versions, `DTriangle::neighbor_by_order` and `DTriangle::vertex_by_order` were public safe functions that accepted an
arbitrary `order` value. These functions used `order` to access fixed-size internal arrays with `get_unchecked`, without checking whether `order` was within bounds. Calling these methods with an out-of-bounds `order` could cause an out-of-bounds read from safe Rust code. This made the old APIs unsound, since safe callers could trigger undefined behavior without using `unsafe`.

The issue was fixed in version `0.29.0` as part of a broader rewrite that replaced the old triangle implementation with `IntTriangle` and removed the affected accessor methods.

## Which versions are affected by RUSTSEC-2025-0164?

1 open source package ship an affected version, including i_triangle.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `i_triangle` | crates.io | From 0.0.0-0 | 0.29.0 |

## How do I fix RUSTSEC-2025-0164?

Upgrade i_triangle to 0.29.0 or later.

## Is RUSTSEC-2025-0164 being exploited?

There is no known exploitation of RUSTSEC-2025-0164 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for RUSTSEC-2025-0164 and fix it if it is affected.

What it is: RUSTSEC-2025-0164 is a memory corruption vulnerability in i_triangle, published on 24 Apr 2025. 
Exploitation: There is no known exploitation of RUSTSEC-2025-0164 in the wild and no public exploit code.

Affected packages and fixed versions:
- i_triangle (crates.io): affected from 0.0.0-0; fixed in 0.29.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/RUSTSEC-2025-0164/ (Markdown: https://insights.sbomify.com/RUSTSEC-2025-0164/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/RUSTSEC-2025-0164

---
From sbomify Insights: https://insights.sbomify.com/RUSTSEC-2025-0164/
Summaries are generated and may contain mistakes; the official description above is the record.
