[PATCH] parsers: check for memory allocation overflows more carefully
Matt Mackall
mpm at selenic.com
Mon Apr 6 15:54:32 CDT 2015
On Mon, 2015-04-06 at 09:23 -0700, Sean Farley wrote:
> Bryan O'Sullivan <bos at serpentine.com> writes:
>
> > # HG changeset patch
> > # User Bryan O'Sullivan <bryano at fb.com>
> > # Date 1428333807 25200
> > # Mon Apr 06 08:23:27 2015 -0700
> > # Node ID 9dcbfb4734e11ac253e7a43a233f4a545703faec
> > # Parent 8a6a86c9a5b58ccc020de1ff0429e72dfa5599fc
> > parsers: check for memory allocation overflows more carefully
> >
> > diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> > --- a/mercurial/parsers.c
> > +++ b/mercurial/parsers.c
> > @@ -867,6 +867,11 @@ static int nt_find(indexObject *self, co
> > static int nt_new(indexObject *self)
> > {
> > if (self->ntlength == self->ntcapacity) {
> > + if (self->ntcapacity >= INT_MAX / (sizeof(nodetree) * 2)) {
> > + PyErr_SetString(PyExc_MemoryError,
> > + "overflow in nt_new");
It is in fact just wide enough without the break to go over 80.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list