##// END OF EJS Templates
revlog: catch revlog corruption in index_baserev...
Boris Feld -
r41108:f4113489 stable
parent child Browse files
Show More
@@ -842,10 +842,11 b' bail:'
842 static inline int index_baserev(indexObject *self, int rev)
842 static inline int index_baserev(indexObject *self, int rev)
843 {
843 {
844 const char *data;
844 const char *data;
845 int result;
845
846
846 if (rev >= self->length) {
847 if (rev >= self->length) {
847 PyObject *tuple = PyList_GET_ITEM(self->added, rev - self->length);
848 PyObject *tuple = PyList_GET_ITEM(self->added, rev - self->length);
848 return (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 3));
849 result = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 3));
849 }
850 }
850 else {
851 else {
851 data = index_deref(self, rev);
852 data = index_deref(self, rev);
@@ -853,8 +854,16 b' static inline int index_baserev(indexObj'
853 return -2;
854 return -2;
854 }
855 }
855
856
856 return getbe32(data + 16);
857 result = getbe32(data + 16);
857 }
858 }
859 if (result > rev) {
860 PyErr_Format(
861 PyExc_ValueError,
862 "corrupted revlog, revision base above revision: %d, %d",
863 rev, result);
864 return -2;
865 }
866 return result;
858 }
867 }
859
868
860 static PyObject *index_deltachain(indexObject *self, PyObject *args)
869 static PyObject *index_deltachain(indexObject *self, PyObject *args)
General Comments 0
You need to be logged in to leave comments. Login now