Patchwork D12376: revlog: fix index_fast_rank (wip)

login
register
mail settings
Submitter phabricator
Date March 15, 2022, 9:38 a.m.
Message ID <differential-rev-PHID-DREV-php4ghgrsnobi7tuiotj-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50720/
State New
Headers show

Comments

phabricator - March 15, 2022, 9:38 a.m.
jcristau created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  As far as I can tell, rank is stored as a 32-bit big endian value, I'm
  not sure how grabbing the first byte can possibly work.  I assume
  there's no test coverage here?
  
  cc @pacien
  
  Fixes: https://www.mercurial-scm.org/repo/hg/rev/e633e660158f

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS




To: jcristau, #hg-reviewers
Cc: pacien, mercurial-patches, 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
@@ -588,7 +588,7 @@ 
 		return 0; /* convention */
 	}
 
-	return *(index_deref(self, pos) + entry_cl2_offset_rank);
+	return getbe32(index_deref(self, pos) + entry_cl2_offset_rank);
 }
 
 /*