Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. crayon
  4. ›
  5. GHSA-xfhw-6mc4-mgxf

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

April 5, 2024

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:

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

References

  • github.com/advisories/GHSA-xfhw-6mc4-mgxf
  • github.com/shawnscode/crayon
  • github.com/shawnscode/crayon/commit/c2fde19caf6149d91faa504263f0bc5cafc35de5
  • github.com/shawnscode/crayon/issues/109
  • rustsec.org/advisories/RUSTSEC-2024-0018.html

Code Behaviors & Features

Detect and mitigate GHSA-xfhw-6mc4-mgxf with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 0.6.0 up to 0.7.1

Solution

Unfortunately, there is no solution available yet.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-908: Use of Uninitialized Resource

Source file

cargo/crayon/GHSA-xfhw-6mc4-mgxf.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:14:53 +0000.