# GHSA-mrrw-grhq-86gf: Ascii allows out-of-bounds array indexing in safe code

> The Rust ascii crate allows out-of-bounds array indexing in safe code, potentially leading to memory corruption or crashes.

- **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:** 25 Feb 2023
- **Also known as:** RUSTSEC-2023-0015

## What is GHSA-mrrw-grhq-86gf?

GHSA-mrrw-grhq-86gf is a memory corruption vulnerability in ascii, published on 25 Feb 2023. 

### Official description

Affected version of this crate had implementation of `From<&mut AsciiStr>` for `&mut [u8]` and `&mut str`. This can result in out-of-bounds array indexing in safe code.

The flaw was corrected in commit [8a6c779](https://github.com/tomprogrammer/rust-ascii/pull/63/commits/8a6c7798c202766bd57d70fb8d12739dd68fb9dc) by removing those impls.

## Which versions are affected by GHSA-mrrw-grhq-86gf?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ascii` | crates.io | From 0.6.1-0 | 0.9.3 |
| `ascii` | crates.io | From 0.7.0 | 0.9.3 |
| `ascii` | crates.io | From 0.7.0 | 0.9.3 |

## How do I fix GHSA-mrrw-grhq-86gf?

Upgrade ascii to 0.9.3 or later.

## Is GHSA-mrrw-grhq-86gf being exploited?

There is no known exploitation of GHSA-mrrw-grhq-86gf in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-mrrw-grhq-86gf and fix it if it is affected.

What it is: GHSA-mrrw-grhq-86gf is a memory corruption vulnerability in ascii, published on 25 Feb 2023. 
Exploitation: There is no known exploitation of GHSA-mrrw-grhq-86gf in the wild and no public exploit code.

Affected packages and fixed versions:
- ascii (crates.io): affected from 0.6.1-0; fixed in 0.9.3
- ascii (crates.io): affected from 0.7.0; fixed in 0.9.3
- ascii (crates.io): affected from 0.7.0; fixed in 0.9.3

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-mrrw-grhq-86gf/ (Markdown: https://insights.sbomify.com/GHSA-mrrw-grhq-86gf/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-mrrw-grhq-86gf

---
From sbomify Insights: https://insights.sbomify.com/GHSA-mrrw-grhq-86gf/
Summaries are generated and may contain mistakes; the official description above is the record.
