D8276: cext-index: propagate inline_scan error in `index_deref`

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Mar 12 18:26:14 UTC 2020


marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this change, revlog index corruption could be silently ignored in some
  situation.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8276

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -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];
 	}



To: marmoute, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list