# GHSA-pfp7-vxgr-83pw: Heap Buffer Overflow in the DrainCol Destructor

> An off-by-one error in the DrainCol destructor causes a heap buffer overflow, potentially allowing code execution or crashes in applications using the TooDee library.

- **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:** 22 May 2025
- **Also known as:** RUSTSEC-2025-0062

## What is GHSA-pfp7-vxgr-83pw?

GHSA-pfp7-vxgr-83pw is a memory corruption vulnerability in toodee, published on 22 May 2025. 

### Official description

An off-by-one error in the `DrainCol::drop` destructor could cause an unsafe memory copy
operation to exceed the bounds of the associated vector.

The error was related to the size of the data being copied in one of the `ptr::copy`
invocations inside the destructor.

When removing the first column from a TooDee object, the DrainCol return object could cause
a heap buffer overflow vulnerability when it is dropped.

The issue was fixed in commit `e6e16d5` by reducing the copied size by one.

## Which versions are affected by GHSA-pfp7-vxgr-83pw?

3 open source packages ship an affected version, including toodee.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `toodee` | crates.io | From 0.2.0 | 0.6.0 |
| `toodee` | crates.io | From 0.2.0 | 0.6.0 |
| `toodee` | crates.io | From 0.2.0 | 0.6.0 |

## How do I fix GHSA-pfp7-vxgr-83pw?

Upgrade toodee to 0.6.0 or later.

## Is GHSA-pfp7-vxgr-83pw being exploited?

There is no known exploitation of GHSA-pfp7-vxgr-83pw in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-pfp7-vxgr-83pw and fix it if it is affected.

What it is: GHSA-pfp7-vxgr-83pw is a memory corruption vulnerability in toodee, published on 22 May 2025. 
Exploitation: There is no known exploitation of GHSA-pfp7-vxgr-83pw in the wild and no public exploit code.

Affected packages and fixed versions:
- toodee (crates.io): affected from 0.2.0; fixed in 0.6.0
- toodee (crates.io): affected from 0.2.0; fixed in 0.6.0
- toodee (crates.io): affected from 0.2.0; fixed in 0.6.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-pfp7-vxgr-83pw/ (Markdown: https://insights.sbomify.com/GHSA-pfp7-vxgr-83pw/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-pfp7-vxgr-83pw

---
From sbomify Insights: https://insights.sbomify.com/GHSA-pfp7-vxgr-83pw/
Summaries are generated and may contain mistakes; the official description above is the record.
