Loading...
Skip to main content

CVE-2026-42199 — Grid: Integer Overflow in grid — CVE Details

MEDIUM

Grid: Integer Overflow in Grid::expand_rows Leads to Safe-API Undefined Behavior

Published April 24, 2026Updated September 10, 2026Source: osv

Summary

### Summary An integer overflow in `Grid::expand_rows()` can corrupt the relationship between the grid’s logical dimensions and its backing storage. After the internal invariant is broken, the safe API get() may invoke get_unchecked() with an invalid index, resulting in Undefined Behavior. ### Details Tested Version: grid = "1.0.0" expand_rows() computes the new backing length using unchecked arithmetic: `self.data.len() + rows * self.cols ` If rows * self.cols or the subsequent addition overflows usize, the result wraps in release builds and self.data may be resized to a length much smaller than logically required. After that, if the grid is in ColumnMajor order, the function performs in-place rotation using indices derived from: ``` let total_rows = self.rows + row_added; let col_idx = i * total_rows; self.data[col_idx..col_idx + total_rows + i].rotate_right(i); ``` These computations also rely on the assumption that the backing storage has been resized to the correct length. Once the earlier length computation has wrapped, this assumption no longer holds, so the function may operate on invalid ranges or otherwise enter an inconsistent state. Finally, the function updates logical metadata with: `self.rows += rows; ` As a result, the grid can end up with logical dimensions that no longer match the actual backing storage. Subsequent safe API calls such as get() may then rely on corrupted metadata and reach unsafe internal accesses, resulting in invalid unchecked access and Undefined Behavior. ### PoC ```rust #![forbid(unsafe_code)] use grid::Grid; fn main() { let mut g = Grid::from_vec(vec![1u8, 2u8], 2); g.expand_rows(usize::MAX / 2); g.get(0, 0); // triggers UB in get_unchecked } ``` ### Impact - Invalid unchecked access (`get_unchecked`) reached via safe API - Confirmed by Miri (release-mode): ``` error: Undefined Behavior: `assume` called with `false` --> ..../grid-1.0.0/src/lib.rs:527:9 | 527 | self.data.get_unchecked(index) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here ``` - Potential crash / denial of service in release-builds (e.g., SIGSEGV, Illegal instruction) - Violates Rust’s safety guarantees despite using only safe code

Advisory Timeline

  • First published April 24, 2026 (171 days ago).
  • Last revised September 10, 2026 — 138 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update grid to 1.0.1 or later
cargo update -p grid --precise 1.0.1

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: crates.io (1).

PackageEcosystemAffectedFixed In
grid
crates.io
All versions1.0.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.2 score means for each attack dimension.

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

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

Frequently Asked Questions

What is CVE-2026-42199?
Grid: Integer Overflow in Grid::expand_rows Leads to Safe-API Undefined Behavior This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.2/10).
How do I check if my project is affected by CVE-2026-42199?
CVE-2026-42199 affects grid. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-42199 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.2

Exploitation requires specific conditions or has limited impact. Remediate within weeks.

Also Known As

GHSA-38c5-483c-4qqp

Related CVEs

  • CVE-2026-102821
    MEDIUM

    Russh: Unbounded memory exhaustion via CHANNEL_OPEN flood during a client-stalled rekey

  • CVE-2026-102820
    MEDIUM

    pageant: Out-of-bounds read / oversized allocation in `pageant` MemoryMap::read via a malicious Pageant agent (Windows)

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies