All reports
Medium

Integer overflow in Unix.map_file

Affected versions

OCaml / opamocaml
Affected versions
<5.5.2
Fixed version
5.5.2

Description

ANT-2026-6W9NPC2Q mmap dimension product integer overflow

Fix

Use caml_umul_overflow instead of * when multiplying bigarray dimensions, which detects integer overflows and raise Failure. Negative positions are also rejected by raising Invalid_argument.

Am I affected?

If either the dimensions or the file size in a call to Unix.map_file from your code is user controllable then you are potentially affected.

Score notes

The vulnerability is in a library, and the CVSS score is calculated under worst case assumptions. For an actual application the score will depend on how much an attacker can control the input to this function (if at all).

Timeline

  • 2026-08-24: vulnerability was found

  • 2026-08-27: forwarded report to security@ocaml.org

  • 2026-09-29: fix merged to trunk

Credits

  • Anthropic
  • Hannes Mehnert
  • Edwin Török
  • Nicolás Ojeda Bär
  • Edwin Török
  • Xavier Leroy