cext-index: propagate inline_scan error in `index_deref`
Before this change, revlog index corruption could be silently ignored in some
situation.
Differential Revision: https://phab.mercurial-scm.org/D8276
--- a/mercurial/cext/revlog.c Thu Mar 12 18:53:37 2020 +0100
+++ b/mercurial/cext/revlog.c Thu Mar 12 15:23:47 2020 +0100
@@ -157,7 +157,10 @@
sizeof(*self->offsets));
if (self->offsets == NULL)
return (const char *)PyErr_NoMemory();
- inline_scan(self, self->offsets);
+ Py_ssize_t ret = inline_scan(self, self->offsets);
+ if (ret == -1) {
+ return NULL;
+ };
}
return self->offsets[pos];
}