D3530: revlog: handle error from node lookup

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri May 11 19:32:00 UTC 2018


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

REVISION SUMMARY
  I missed this in https://phab.mercurial-scm.org/D3499. Thanks to Yuya for spotting it.

REPOSITORY
  rHG Mercurial

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

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
@@ -1286,7 +1286,9 @@
 		v = n->children[k];
 		if (v < 0) {
 			v = -(v + 1);
-			const char *n = index_node(self, v);
+			const char *n = index_node_existing(self, v);
+			if (n == NULL)
+				return -3;
 			if (memcmp(node, n, 20) != 0)
 				/*
 				 * Found a unique prefix, but it wasn't for the



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


More information about the Mercurial-devel mailing list