CVE-2026-42199: Rust Unchecked Arithmetic In Resize

Capacity calculations using unchecked arithmetic (`+`, `*`) can overflow, causing insufficient allocation and potential out-of-bounds access. If the buffer is unexpectedly truncated, subsequent operations assuming un-wrapped dimensions can trigger Undefined Behavior. Use `checked_add` and `checked_mul` to compute buffer dimensions safely securely.

Provally CuratedPublic repositoryMediumMedium confidenceVerifiedApache-2.0Rustβ
greprules fetch cve-2026-42199-rust-unchecked-arithmetic-in-resize --engine opengrep

Description

Capacity calculations using unchecked arithmetic (`+`, `*`) can overflow, causing insufficient allocation and potential out-of-bounds access. If the buffer is unexpectedly truncated, subsequent operations assuming un-wrapped dimensions can trigger Undefined Behavior. Use `checked_add` and `checked_mul` to compute buffer dimensions safely securely.