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; }