changeset 44500:864e9534d3d4 stable

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 12 Mar 2020 15:23:47 +0100
parents daf083140b5b
children bc9a9016467d
files mercurial/cext/revlog.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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];
 	}