# HG changeset patch # User Alex Gaynor # Date 1516224978 0 # Node ID cf2e2a7399bc2e7ea5dccc7de546ce107cf5f3aa # Parent 9c575c22dcf4305db2160dc45350ba8e40cf5e60 bdiff: handle the possibility of an integer overflow when allocating Differential Revision: https://phab.mercurial-scm.org/D1877 diff -r 9c575c22dcf4 -r cf2e2a7399bc mercurial/bdiff.c --- a/mercurial/bdiff.c Tue Jan 16 08:40:14 2018 -0500 +++ b/mercurial/bdiff.c Wed Jan 17 21:36:18 2018 +0000 @@ -41,7 +41,7 @@ if (p == plast) i++; - *lr = l = (struct bdiff_line *)malloc(sizeof(struct bdiff_line) * i); + *lr = l = (struct bdiff_line *)calloc(i, sizeof(struct bdiff_line)); if (!l) return -1;