CVE-2026-42199: Grid Integer Overflow Vulnerability
MODERATECVE-2026-42199 is a MODERATE (CVSS 6.2) integer overflow vulnerability (CWE-190: Integer Overflow or Wraparound) affecting Grid libraries in the crates.io ecosystem. The issue involves integer overflow in grid::expand_rows leads to safe-api undefined behavior. Remediation is available by upgrading affected packages to version 1.0.1.
CVE-2026-42199 at a Glance
Security Impact
CVSS: 6.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-42199
To remediate this vulnerability, upgrade all affected Grid dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade grid to 1.0.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for grid
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-42199, inspect your project dependencies for Grid:
inspect dependencies for grid
Analyze the terminal output to locate any version of Grid in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In Grid, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-42199 Affected Grid Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
grid
|
crates.io |
≥ 0.17.0
< 1.0.1
|
1.0.1
|
References
Frequently Asked Questions
What is CVE-2026-42199?
Which Grid versions are affected?
What version fixes CVE-2026-42199?
Is grid affected?
What is the CVSS score of CVE-2026-42199?
What CWE is associated with CVE-2026-42199?
How can I check crates.io dependencies for CVE-2026-42199?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-38c5-483c-4qqp",
"modified" : "2026-05-13T13:37:34Z",
"published" : "2026-04-24T15:57:36Z",
"aliases" : [ "CVE-2026-42199" ],
"summary" : "Grid: Integer Overflow in Grid::expand_rows Leads to Safe-API Undefined Behavior",
"details" : "### Summary\nAn 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.\n\n### Details\nTested Version: grid = \"1.0.0\"\n\nexpand_rows() computes the new backing length using unchecked arithmetic:\n\n`self.data.len() + rows * self.cols\n`\n\nIf 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.\n\nAfter that, if the grid is in ColumnMajor order, the function performs in-place rotation using indices derived from:\n\n```\nlet total_rows = self.rows + row_added;\nlet col_idx = i * total_rows;\nself.data[col_idx..col_idx + total_rows + i].rotate_right(i);\n```\n\nThese 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.\n\nFinally, the function updates logical metadata with:\n\n`self.rows += rows;\n`\n\nAs 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.\n\n### PoC\n```rust\n#![forbid(unsafe_code)]\n\nuse grid::Grid;\n\nfn main() {\n let mut g = Grid::from_vec(vec![1u8, 2u8], 2);\n\n g.expand_rows(usize::MAX / 2);\n\n g.get(0, 0); // triggers UB in get_unchecked\n}\n```\n\n### Impact\n- Invalid unchecked access (`get_unchecked`) reached via safe API\n- Confirmed by Miri (release-mode):\n\n```\nerror: Undefined Behavior: `assume` called with `false`\n --> ..../grid-1.0.0/src/lib.rs:527:9\n |\n527 | self.data.get_unchecked(index)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here\n\n```\n- Potential crash / denial of service in release-builds (e.g., SIGSEGV, Illegal instruction)\n- Violates Rust’s safety guarantees despite using only safe code",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "grid"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.17.0"
}, {
"fixed" : "1.0.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.0.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/becheran/grid/security/advisories/GHSA-38c5-483c-4qqp"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42199"
}, {
"type" : "WEB",
"url" : "https://github.com/becheran/grid/commit/be213bd3528727148bef2d523c89e95d1fd9c072"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/becheran/grid"
}, {
"type" : "WEB",
"url" : "https://github.com/becheran/grid/releases/tag/v1.0.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-190" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-24T15:57:36Z",
"nvd_published_at" : "2026-05-08T22:16:31Z"
}
}