GHSA-qvc4-78gw-pv8p: Adverserial use of `make_bitflags!` macro can cause undefined behavior
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
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 →