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

login
register
mail settings
Submitter phabricator
Date March 12, 2020, 6:26 p.m.
Message ID <differential-rev-PHID-DREV-utondsl4ixgzwt4h4yo6-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45756/
State Superseded
Headers show

Comments

phabricator - March 12, 2020, 6:26 p.m.
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




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

Patch

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