revlog: cache delta base value under -1 stable
authorBoris Feld <boris.feld@octobus.net>
Sun, 30 Dec 2018 16:11:06 +0100
branchstable
changeset 41019 7542466b94e2
parent 41018 f4113489e4d4
child 41020 fbd5e2f0bba7
revlog: cache delta base value under -1 Such base are invalid so we better report them early.
mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c	Thu Dec 27 23:34:37 2018 +0100
+++ b/mercurial/cext/revlog.c	Sun Dec 30 16:11:06 2018 +0100
@@ -863,6 +863,13 @@
 		    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;
 }