Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. enumflags2
  4. ›
  5. GHSA-qvc4-78gw-pv8p

GHSA-qvc4-78gw-pv8p: Adverserial use of `make_bitflags!` macro can cause undefined behavior

April 24, 2023

The macro relied on an expression of the form Enum::Variant always being a variant of the enum. However, it may also be an associated integer constant, in which case there’s no guarantee that the value of said constant consists only of bits valid for this bitflag type.

Thus, code like this could create an invalid BitFlags<Test>, which would cause iterating over it to trigger undefined behavior. As the debug formatter internally iterates over the value, it is also affected.

use enumflags2::{bitflags, make_bitflags};

References

  • github.com/advisories/GHSA-qvc4-78gw-pv8p
  • github.com/meithecatte/enumflags2
  • github.com/meithecatte/enumflags2/releases/tag/v0.7.7
  • rustsec.org/advisories/RUSTSEC-2023-0035.html

Code Behaviors & Features

Detect and mitigate GHSA-qvc4-78gw-pv8p 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.7.0 before 0.7.7

Fixed versions

  • 0.7.7

Solution

Upgrade to version 0.7.7 or above.

Source file

cargo/enumflags2/GHSA-qvc4-78gw-pv8p.yml

Spotted a mistake? Edit the file on GitLab.

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

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