From 7ba743fd53b2142434f2870d51d992ecbc22816b Mon Sep 17 00:00:00 2001 From: Debian Python Team Date: Wed, 25 Aug 2021 18:54:04 +0100 Subject: [PATCH] proposed_upstream__revlog_s390x_part1 # HG changeset patch # User Julien Cristau # Date 1629801874 -7200 # Tue Aug 24 12:44:34 2021 +0200 # Branch stable # Node ID 518dd67482c0bde8636d1a5e6f10cb369b522e1f # Parent df94c13ddf60b5c355db04d9a6dde9ce80d58df3 revlog: fix type confusion with sidedata_comp_len (issue6580) The format string uses "i" (int) for sidedata_comp_len, so we shouldn't be passing a pointer to Py_ssize_t to PyArg_ParseTuple. On 64-bit big-endian, this would result in python only writing to the upper 32 bits, and things go downhill from there. Differential Revision: https://phab.mercurial-scm.org/D11334 Gbp-Pq: Name proposed_upstream__revlog_s390x_part1.patch --- mercurial/cext/revlog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c index ea255f6..1ea4d4f 100644 --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -452,9 +452,10 @@ static int node_check(Py_ssize_t nodelen, PyObject *obj, char **node) static PyObject *index_append(indexObject *self, PyObject *obj) { uint64_t offset_flags, sidedata_offset; - int rev, comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2; + int rev, comp_len, uncomp_len, base_rev, link_rev, parent_1, parent_2, + sidedata_comp_len; char data_comp_mode, sidedata_comp_mode; - Py_ssize_t c_node_id_len, sidedata_comp_len; + Py_ssize_t c_node_id_len; const char *c_node_id; char comp_field; char *data; @@ -534,9 +535,8 @@ static PyObject *index_append(indexObject *self, PyObject *obj) static PyObject *index_replace_sidedata_info(indexObject *self, PyObject *args) { uint64_t offset_flags, sidedata_offset; - int rev; + int rev, sidedata_comp_len; char comp_mode; - Py_ssize_t sidedata_comp_len; char *data; #if LONG_MAX == 0x7fffffffL const char *const sidedata_format = PY23("nKiKB", "nKiKB"); -- 2.30.2