D1877: bdiff: Handle the possibility of an integer overflow when allocating

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Jan 17 16:42:05 EST 2018


indygreg added inline comments.

INLINE COMMENTS

> bdiff.c:44
>  
> -	*lr = l = (struct bdiff_line *)malloc(sizeof(struct bdiff_line) * i);
> +	*lr = l = (struct bdiff_line *)calloc(i, sizeof(struct bdiff_line));
>  	if (!l)

Memory throughput is already a bottleneck in bdiff code. Is there an impact on `hg perfbdiff` with the change from `malloc()` to `calloc()`?

REPOSITORY
  rHG Mercurial

BRANCH
  alloc-overflow (bookmark) on default (branch)

REVISION DETAIL
  https://phab.mercurial-scm.org/D1877

To: alex_gaynor, #hg-reviewers, durin42
Cc: indygreg, durin42, mercurial-devel


More information about the Mercurial-devel mailing list