Patchwork D11335: revlog: fix more type confusion in index_replace_sidedata_info (issue6580)

login
register
mail settings
Submitter phabricator
Date Aug. 24, 2021, 9:45 p.m.
Message ID <differential-rev-PHID-DREV-pvzfvg3l4fwahekrr7wv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49650/
State Superseded
Headers show

Comments

phabricator - Aug. 24, 2021, 9:45 p.m.
jcristau created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We were telling python that "rev" was a Py_ssize_t (via the "n" format),
  but it was actually an int.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS




To: jcristau, #hg-reviewers
Cc: 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
@@ -535,7 +535,8 @@ 
 static PyObject *index_replace_sidedata_info(indexObject *self, PyObject *args)
 {
 	uint64_t offset_flags, sidedata_offset;
-	int rev, sidedata_comp_len;
+	Py_ssize_t rev;
+	int sidedata_comp_len;
 	char comp_mode;
 	char *data;
 #if LONG_MAX == 0x7fffffffL