Integer overflows when unmarshaling a bigarray
authorStephane Glondu <steph@glondu.net>
Fri, 25 Jan 2019 13:34:23 +0000 (14:34 +0100)
committerStéphane Glondu <glondu@debian.org>
Tue, 6 Aug 2019 07:27:23 +0000 (09:27 +0200)
commit2834fffdb0ad581f80eb27e8ce8f182060c1f83b
tree4bc55e4748b43e91b80b96a2a8b3bdca5d6944a1
parentf483bd812c95d1ee9abf9a7f55eedc435366d717
Integer overflows when unmarshaling a bigarray

Malicious or corrupted marshaled data can result in a bigarray
with impossibly large dimensions that cause overflow when computing
the in-memory size of the bigarray.  Disaster ensues when the data
is read in a too small memory area.  This commit checks for overflows
when computing the in-memory size of the bigarray.

This patch has been modified from upstream one to use caml_ba_multov
instead of caml_umul_overflow which is unavailable in OCaml 4.05.0.

Origin: https://github.com/ocaml/ocaml/pull/1718
Bug: https://caml.inria.fr/mantis/view.php?id=7765
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895472
Bug-CVE: CVE-2018-9838

Gbp-Pq: Name 0012-Integer-overflows-when-unmarshaling-a-bigarray.patch
otherlibs/bigarray/bigarray_stubs.c