##// END OF EJS Templates
base85: cast Py_ssize_t values to int (issue3481)...
Adrian Buehlmann -
r16848:19a915d4 default
parent child Browse files
Show More
@@ -111,7 +111,8 b' b85decode(PyObject *self, PyObject *args'
111 111 if (c < 0)
112 112 return PyErr_Format(
113 113 PyExc_ValueError,
114 "bad base85 character at position %d", i);
114 "bad base85 character at position %d",
115 (int)i);
115 116 acc = acc * 85 + c;
116 117 }
117 118 if (i++ < len)
@@ -120,13 +121,15 b' b85decode(PyObject *self, PyObject *args'
120 121 if (c < 0)
121 122 return PyErr_Format(
122 123 PyExc_ValueError,
123 "bad base85 character at position %d", i);
124 "bad base85 character at position %d",
125 (int)i);
124 126 /* overflow detection: 0xffffffff == "|NsC0",
125 127 * "|NsC" == 0x03030303 */
126 128 if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c)
127 129 return PyErr_Format(
128 130 PyExc_ValueError,
129 "bad base85 sequence at position %d", i);
131 "bad base85 sequence at position %d",
132 (int)i);
130 133 acc += c;
131 134 }
132 135
General Comments 0
You need to be logged in to leave comments. Login now