CVE-2026-34353
Integer Overflow in OCaml Bigarray.reshape Allows Arbitrary Memory Read
Publication date: 2026-03-27
Last updated on: 2026-04-14
Assigner: MITRE
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| ocaml | ocaml | to 4.14.3 (inc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-190 | 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. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-34353 is a vulnerability in the OCaml programming language's Bigarray.reshape function, present through version 4.14.3. The issue arises because the function does not properly handle integer overflow when reshaping bigarrays. This improper handling allows the function to read arbitrary or uninitialized memory.
Specifically, when reshaping a bigarray with dimensions that cause the total number of elements to overflow the integer range, the internal data pointer is not updated or reallocated correctly. This leads to the function allowing access to memory that should not be accessible, potentially exposing random or sensitive data.
The vulnerability was identified as a size overflow problem in the OCaml runtime's bigarray.c component and has been fixed by backporting a patch to OCaml 4.14 to prevent such size overflow errors.
How can this vulnerability impact me? :
This vulnerability can impact you by allowing an attacker or untrusted data to cause the program to read arbitrary or uninitialized memory. This can lead to information disclosure, where sensitive data in memory might be exposed unintentionally.
Because the overflow allows reading beyond the intended memory bounds without proper checks, it can cause undefined behavior in applications using OCaml's Bigarray.reshape, potentially compromising data integrity or confidentiality.
The CVSS base score of 5.9 indicates a medium severity, with the attack vector being local and requiring high attack complexity, but no privileges or user interaction needed.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability arises from an integer overflow in the OCaml Bigarray.reshape function when processing untrusted data, leading to reading uninitialized memory.
Detection involves identifying if OCaml versions up to 4.14.3 are in use and if the Bigarray.reshape function is called with dimensions that could cause integer overflow.
There are no specific network detection commands provided, but testing can be done by running OCaml code that attempts to reshape bigarrays with large dimensions to see if unexpected memory reads occur.
- Run OCaml code that creates a zero-length bigarray and reshapes it with very large dimensions, for example: reshape to dimensions [8; 2305843009213693952].
- Check if accessing elements after reshaping returns uninitialized or random values, indicating the vulnerability.
- Monitor for absence of expected exceptions like Out_of_memory during such operations.
What immediate steps should I take to mitigate this vulnerability?
The primary mitigation is to update OCaml to a version where the vulnerability is fixed.
The fix was originally included in OCaml version 5.0 and backported to the 4.14 branch via pull request #14674.
- Upgrade OCaml to version 5.0 or later, or apply the backported fix to OCaml 4.14.3.
- Avoid processing untrusted data with Bigarray.reshape until the fix is applied.
- Review and test your code for any use of Bigarray.reshape that could trigger integer overflow.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability in OCaml's Bigarray.reshape function allows reading of arbitrary memory due to an integer overflow, which can lead to information disclosure by accessing uninitialized memory.
Such unauthorized memory reads could potentially expose sensitive data, which may impact compliance with data protection standards and regulations like GDPR and HIPAA that require safeguarding personal and sensitive information.
However, the provided information does not explicitly discuss the direct impact on compliance frameworks or regulatory requirements.