]> granicus.if.org Git - gc/commit
Fix calloc_explicitly_typed in case of lb*n overflow
authorIvan Maidanski <ivmai@mail.ru>
Thu, 15 Sep 2016 15:40:21 +0000 (18:40 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 11 Nov 2016 05:34:53 +0000 (08:34 +0300)
commita230ee8b21111b88749a97e6801048db1859a0fc
treeca83dacd25e5e6eef5a87b717bb8e843bf3e6494
parent9343a8fdc20c824475b9f5a06db06bbfb0f6142f
Fix calloc_explicitly_typed in case of lb*n overflow
(Cherry-pick commit 41a9ed4 from 'release-7_4' branch.)

* typd_mlc.c: Include limits.h (for SIZE_MAX).
* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in
malloc.c).
* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n
overflows (same algorithm as in calloc defined in malloc.c); eliminate
lb *= n code duplication.
typd_mlc.c