OCaml: Buffer overflow and information disclosure — GLSA 201702-15

A buffer overflow in OCaml might allow remote attackers to obtain sensitive information or crash an OCaml-based application.

Affected packages

dev-lang/ocaml on all architectures
Affected versions < 4.04.0
Unaffected versions >= 4.04.0


OCaml is a high-level, strongly-typed, functional, and object-oriented programming language from the ML family of languages.


It was discovered that OCaml was vulnerable to a runtime bug that, on 64-bit platforms, causes size arguments to internal memmove calls to be sign-extended from 32- to 64-bits before being passed to the memmove function. This leads to arguments between 2GiB and 4GiB being interpreted as larger than they are (specifically, a bit below 2^64), causing a buffer overflow. Further, arguments between 4GiB and 6GiB are interpreted as 4GiB smaller than they should be causing a possible information leak.


A remote attacker, able to interact with an OCaml-based application, could possibly obtain sensitive information or cause a Denial of Service condition.


There is no known workaround at this time.


All OCaml users should upgrade to the latest version:

 # emerge --sync
 # emerge --ask --oneshot --verbose ">=dev-lang/ocam-4.04.0"

Packages which depend on OCaml may need to be recompiled. Tools such as qdepends (included in app-portage/portage-utils) may assist in identifying these packages:

 # emerge --oneshot --ask --verbose $(qdepends -CQ dev-lang/ocaml | sed


Release date
February 20, 2017

Latest revision
February 20, 2017: 1



Bugzilla entries