Mercurial > hg-stable
changeset 35723:50868145a8de
bdiff: handle the possibility of overflow when computing allocation size
Differential Revision: https://phab.mercurial-scm.org/D1904
author | Alex Gaynor <agaynor@mozilla.com> |
---|---|
date | Thu, 18 Jan 2018 14:43:04 +0000 |
parents | f18ba40d792f |
children | 853bf7d90804 |
files | mercurial/bdiff.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bdiff.c Tue Jan 02 10:09:08 2018 -0700 +++ b/mercurial/bdiff.c Thu Jan 18 14:43:04 2018 +0000 @@ -95,7 +95,7 @@ /* try to allocate a large hash table to avoid collisions */ for (scale = 4; scale; scale /= 2) { - h = (struct pos *)malloc(scale * buckets * sizeof(struct pos)); + h = (struct pos *)calloc(buckets, scale * sizeof(struct pos)); if (h) break; }