# HG changeset patch # User Adrian Buehlmann # Date 2012-06-04 14:59:34 # Node ID 19a915d43a68c5367dbb3d90069a56afef234dec # Parent cda5402b17397b88bd02f502bd5277bbd0cf1895 base85: cast Py_ssize_t values to int (issue3481) If it outputs a nonsense value, no harm done, it was nonsense to start with. diff --git a/mercurial/base85.c b/mercurial/base85.c --- a/mercurial/base85.c +++ b/mercurial/base85.c @@ -111,7 +111,8 @@ b85decode(PyObject *self, PyObject *args if (c < 0) return PyErr_Format( PyExc_ValueError, - "bad base85 character at position %d", i); + "bad base85 character at position %d", + (int)i); acc = acc * 85 + c; } if (i++ < len) @@ -120,13 +121,15 @@ b85decode(PyObject *self, PyObject *args if (c < 0) return PyErr_Format( PyExc_ValueError, - "bad base85 character at position %d", i); + "bad base85 character at position %d", + (int)i); /* overflow detection: 0xffffffff == "|NsC0", * "|NsC" == 0x03030303 */ if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c) return PyErr_Format( PyExc_ValueError, - "bad base85 sequence at position %d", i); + "bad base85 sequence at position %d", + (int)i); acc += c; }