# GHSA-xfhw-6mc4-mgxf: crayon: ObjectPool creates uninitialized memory when freeing objects

- Severity: High 7.5 (CVSS:3.1, scored by GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2024-02-27T12:00:00.000Z
- Modified: 2024-04-11T16:41:43.882Z
- Also known as: RUSTSEC-2024-0018
- Weaknesses: CWE-908

## Description

As of version 0.6.0, the ObjectPool explicitly creates an uninitialized instance of its type parameter when it attempts to free an object, and swaps it into the storage. This causes instant undefined behavior due to reading the uninitialized memory in order to write it to the pool storage.

Extremely basic usage of the crate can trigger this issue, e.g. this code from a doctest:

```rust
use crayon::prelude::*;
application::oneshot().unwrap();

let mut params = MeshParams::default();

let mesh = video::create_mesh(params, None).unwrap();

// Deletes the mesh object.
video::delete_mesh(mesh); // <-- UB
```

The Clippy warning for this code was silenced in commit c2fde19caf6149d91faa504263f0bc5cafc35de5.

Discovered via https://asan.saethlin.dev/ub?crate=crayon&version=0.7.1

(As written by GitHub Advisory Database.)

## Affected

- crayon (crates.io): from 0.6.0 up to 0.7.1; from 0.6.0

## References

- <https://github.com/shawnscode/crayon/issues/109> (report, web)
- <https://github.com/shawnscode/crayon/commit/c2fde19caf6149d91faa504263f0bc5cafc35de5> (web)
- <https://github.com/shawnscode/crayon> (package)
- <https://rustsec.org/advisories/RUSTSEC-2024-0018.html> (advisory, web)
- <https://crates.io/crates/crayon> (package)

## Sources

- GitHub Advisory Database: [GHSA-xfhw-6mc4-mgxf](https://github.com/advisories/GHSA-xfhw-6mc4-mgxf), CC-BY-4.0, modified 2024-04-11
- RustSec Advisory Database: [RUSTSEC-2024-0018](https://rustsec.org/advisories/RUSTSEC-2024-0018.html), CC0-1.0, modified 2024-04-11

---

Page: https://cve.day/GHSA-xfhw-6mc4-mgxf · Whole record: https://cve.day/GHSA-xfhw-6mc4-mgxf.json · Rebuilt by cve.day 2026-11-25T22:56:43.187Z
