# GHSA-h5j3-crg5-8jqm: orx-pinned-vec has undefined behavior in index_of_ptr with empty slices

> An integer underflow in index_of_ptr causes undefined behavior with empty slices, potentially leading to crashes or code execution.

- **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:** 21 Oct 2025
- **Also known as:** RUSTSEC-2025-0106

## What is GHSA-h5j3-crg5-8jqm?

GHSA-h5j3-crg5-8jqm is a vulnerability in orx-pinned-vec, published on 21 Oct 2025. 

### Official description

The safe function `index_of_ptr` causes undefined behavior when called with an empty slice.

The issue occurs in the line `ptr.add(slice.len() - 1)` which underflows when `slice.len()` is 0, creating a pointer with a massive offset. According to Rust's safety rules, creating such a pointer causes immediate undefined behavior.

## Which versions are affected by GHSA-h5j3-crg5-8jqm?

3 open source packages ship an affected version, including orx-pinned-vec.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `orx-pinned-vec` | crates.io | All versions | 3.21.0 |
| `orx-pinned-vec` | crates.io | All versions | 3.21.0 |
| `orx-pinned-vec` | crates.io | From 0.0.0-0 | 3.21.0 |

## How do I fix GHSA-h5j3-crg5-8jqm?

Upgrade orx-pinned-vec to 3.21.0 or later.

## Is GHSA-h5j3-crg5-8jqm being exploited?

There is no known exploitation of GHSA-h5j3-crg5-8jqm in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-h5j3-crg5-8jqm and fix it if it is affected.

What it is: GHSA-h5j3-crg5-8jqm is a vulnerability in orx-pinned-vec, published on 21 Oct 2025. 
Exploitation: There is no known exploitation of GHSA-h5j3-crg5-8jqm in the wild and no public exploit code.

Affected packages and fixed versions:
- orx-pinned-vec (crates.io): affected all versions; fixed in 3.21.0
- orx-pinned-vec (crates.io): affected all versions; fixed in 3.21.0
- orx-pinned-vec (crates.io): affected from 0.0.0-0; fixed in 3.21.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/GHSA-h5j3-crg5-8jqm/ (Markdown: https://insights.sbomify.com/GHSA-h5j3-crg5-8jqm/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-h5j3-crg5-8jqm

---
From sbomify Insights: https://insights.sbomify.com/GHSA-h5j3-crg5-8jqm/
Summaries are generated and may contain mistakes; the official description above is the record.
