From patchwork Mon Dec 31 17:38:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [STABLE] revlog: cache delta base value under -1 From: Boris Feld X-Patchwork-Id: 37416 Message-Id: <38e950b3a3bca863b5e2.1546277915@Laptop-Boris.lan> To: mercurial-devel@mercurial-scm.org Date: Mon, 31 Dec 2018 18:38:35 +0100 # HG changeset patch # User Boris Feld # Date 1546182666 -3600 # Sun Dec 30 16:11:06 2018 +0100 # Branch stable # Node ID 38e950b3a3bca863b5e2cabda69f5ae641d581d6 # Parent f4113489e4d493ffb0aa6c3c58454dc7e3b82e83 # EXP-Topic base-check # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 38e950b3a3bc revlog: cache delta base value under -1 Such base are invalid so we better report them early. diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -863,6 +863,13 @@ static inline int index_baserev(indexObj rev, result); return -2; } + if (result < -1) { + PyErr_Format( + PyExc_ValueError, + "corrupted revlog, revision base out of range: %d, %d", + rev, result); + return -2; + } return result; }